Example #1
0
 function image($img, $x, $y, $w, $h, $resolution = "normal")
 {
     list($width, $height, $type) = Helpers::dompdf_getimagesize($img);
     $debug_png = $this->_dompdf->get_option("debug_png");
     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!!!';
             }
     }
 }