Ejemplo n.º 1
0
 public function drawImage($image, $sx, $sy, $sw = null, $sh = null, $dx = null, $dy = null, $dw = null, $dh = null)
 {
     if (self::DEBUG) {
         echo __FUNCTION__ . "\n";
     }
     if (strpos($image, "data:") === 0) {
         $data = substr($image, strpos($image, ";") + 1);
         if (strpos($data, "base64") === 0) {
             $data = base64_decode(substr($data, 7));
         }
         $image = tempnam("", "svg");
         file_put_contents($image, $data);
     }
     $img = $this->canvas->load_image("auto", $image, "");
     $sy = $sy - $sh;
     $this->canvas->fit_image($img, $sx, $sy, 'boxsize={' . "{$sw} {$sh}" . '} fitmethod=entire');
 }