function image($img, $x, $y, $w, $h, $resolution = "normal")
 {
     list($width, $height, $type) = dompdf_getimagesize($img);
     $debug_png = $this->_dompdf->get_option("debug_png");
     if ($debug_png) {
         print "[image:{$img}|{$width}|{$height}|{$type}]";
     }
     switch ($type) {
         case IMAGETYPE_JPEG:
             if ($debug_png) {
                 print '!!!jpg!!!';
             }
             $this->_pdf->addJpegFromFile($img, $x, $this->y($y) - $h, $w, $h);
             break;
         case IMAGETYPE_GIF:
         case IMAGETYPE_BMP:
             if ($debug_png) {
                 print '!!!bmp or gif!!!';
             }
             // @todo use cache for BMP and GIF
             $img = $this->_convert_gif_bmp_to_png($img, $type);
         case IMAGETYPE_PNG:
             if ($debug_png) {
                 print '!!!png!!!';
             }
             $this->_pdf->addPngFromFile($img, $x, $this->y($y) - $h, $w, $h);
             break;
         default:
             if ($debug_png) {
                 print '!!!unknown!!!';
             }
     }
 }
 function image($img_url, $img_type, $x, $y, $w, $h)
 {
     switch ($img_type) {
         case "jpeg":
         case "jpg":
             $this->_pdf->addJpegFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
             break;
         case "png":
             $this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
             break;
         default:
             break;
     }
     return;
 }
Example #3
0
 function image($img, $x, $y, $w, $h, $resolution = "normal")
 {
     list($width, $height, $type) = $this->getimagesize($img);
     switch ($type) {
         case IMAGETYPE_JPEG:
             $this->canvas->addJpegFromFile($img, $x, $y - $h, $w, $h);
             break;
         case IMAGETYPE_GIF:
         case IMAGETYPE_BMP:
             // @todo use cache for BMP and GIF
             $img = $this->_convert_gif_bmp_to_png($img, $type);
         case IMAGETYPE_PNG:
             $this->canvas->addPngFromFile($img, $x, $y - $h, $w, $h);
             break;
         default:
     }
 }
 function image($img_url, $img_type, $x, $y, $w, $h)
 {
     $img_type = mb_strtolower($img_type);
     switch ($img_type) {
         case "jpeg":
         case "jpg":
             $this->_pdf->addJpegFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
             break;
         case "png":
             $this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
             break;
         case "gif":
             // Convert gifs to pngs
             $img_url = $this->_convert_gif_to_png($img_url);
             $this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
             break;
         default:
             break;
     }
     return;
 }
Example #5
0
 function image($img, $x, $y, $w, $h, $resolution = "normal")
 {
     list($width, $height, $type) = Helpers::dompdf_getimagesize($img, $this->get_dompdf()->getHttpContext());
     $debug_png = $this->_dompdf->getOptions()->getDebugPng();
     if ($debug_png) {
         print "[image:{$img}|{$width}|{$height}|{$type}]";
     }
     switch ($type) {
         case "jpeg":
             if ($debug_png) {
                 print '!!!jpg!!!';
             }
             $this->_pdf->addJpegFromFile($img, $x, $this->y($y) - $h, $w, $h);
             break;
         case "gif":
         case "bmp":
             if ($debug_png) {
                 print '!!!bmp or gif!!!';
             }
             // @todo use cache for BMP and GIF
             $img = $this->_convert_gif_bmp_to_png($img, $type);
         case "png":
             if ($debug_png) {
                 print '!!!png!!!';
             }
             $this->_pdf->addPngFromFile($img, $x, $this->y($y) - $h, $w, $h);
             break;
         case "svg":
             if ($debug_png) {
                 print '!!!SVG!!!';
             }
             $this->_pdf->addSvgFromFile($img, $x, $this->y($y) - $h, $w, $h);
             break;
         default:
             if ($debug_png) {
                 print '!!!unknown!!!';
             }
     }
 }
Example #6
0
 function image($img_url, $img_type, $x, $y, $w, $h)
 {
     //debugpng
     if (DEBUGPNG) {
         print '[image:' . $img_url . '|' . $img_type . ']';
     }
     $img_type = mb_strtolower($img_type);
     switch ($img_type) {
         case "jpeg":
         case "jpg":
             //debugpng
             if (DEBUGPNG) {
                 print '!!!jpg!!!';
             }
             $this->_pdf->addJpegFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
             break;
         case "png":
             //debugpng
             if (DEBUGPNG) {
                 print '!!!png!!!';
             }
             $this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
             break;
         case "gif":
             // Convert gifs to pngs
             //DEBUG_IMG_TEMP
             //if (0) {
             if (method_exists($this->_pdf, "addImagePng")) {
                 //debugpng
                 if (DEBUGPNG) {
                     print '!!!gif addImagePng!!!';
                 }
                 //If optimization to direct png creation from gd object is available,
                 //don't create temp file, but place gd object directly into the pdf
                 if (method_exists($this->_pdf, "image_iscached") && $this->_pdf->image_iscached($img_url)) {
                     //If same image has occured already before, no need to load because
                     //duplicate will anyway be eliminated.
                     $img = null;
                 } else {
                     $img = @imagecreatefromgif($img_url);
                     if (!$img) {
                         return;
                     }
                     imageinterlace($img, 0);
                 }
                 $this->_pdf->addImagePng($img_url, $x, $this->y($y) - $h, $w, $h, $img);
             } else {
                 //debugpng
                 if (DEBUGPNG) {
                     print '!!!gif addPngFromFile!!!';
                 }
                 $img_url = $this->_convert_gif_to_png($img_url);
                 $this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
             }
             break;
         default:
             //debugpng
             if (DEBUGPNG) {
                 print '!!!unknown!!!';
             }
             break;
     }
     return;
 }
Example #7
0
    function image($img, $x, $y, $w, $h, $resolution = "normal")
    {
        list($width, $height, $type) = dompdf_getimagesize($img);

        //debugpng
        if (DEBUGPNG) print "[image:$img|$width|$height|$type]";

        switch ($type) {
            case IMAGETYPE_JPEG:
                if (DEBUGPNG) print '!!!jpg!!!';
                $this->_pdf->addJpegFromFile($img, $x, $this->y($y) - $h, $w, $h);
                break;

            case IMAGETYPE_GIF:
            case IMAGETYPE_BMP:
                if (DEBUGPNG) print '!!!bmp or gif!!!';
                // @todo use cache for BMP and GIF
                $img = $this->_convert_gif_bmp_to_png($img, $type);

            case IMAGETYPE_PNG:
                if (DEBUGPNG) print '!!!png!!!';

                $this->_pdf->addPngFromFile($img, $x, $this->y($y) - $h, $w, $h);
                break;

            default:
                if (DEBUGPNG) print '!!!unknown!!!';
        }
    }