diff --git a/include/mpdf/config.php b/include/mpdf/config.php index 79d6ce4914910de77974f8ba3a42eb01f9b9eb19..55c64b648720b27311818dee1b3944a3bf401a6e 100755 --- a/include/mpdf/config.php +++ b/include/mpdf/config.php @@ -568,5 +568,9 @@ $this->outerblocktags = array('DIV','FORM','CENTER','DL','FIELDSET','ARTICLE','A $this->innerblocktags = array('P','BLOCKQUOTE','ADDRESS','PRE','H1','H2','H3','H4','H5','H6','DT','DD','CAPTION'); +// OSTICKET CUSTOM ------------------------------- +// Don't process alpha channels of PNG images +$this->png_alpha_use_white_matte = true; + ?> diff --git a/include/mpdf/mpdf.php b/include/mpdf/mpdf.php index b2a28b06b3e47d8e711ef177621c5e310540731f..91d310dda8dc9c810d5697873de236a2f5a7b3a1 100755 --- a/include/mpdf/mpdf.php +++ b/include/mpdf/mpdf.php @@ -9859,7 +9859,23 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal if ($im) { $tempfile = _MPDF_TEMP_PATH.'_tempImgPNG'.RAND(1,10000).'.png'; // Alpha channel set - if ($pngalpha) { + if ($pngalpha && $this->png_alpha_use_white_matte) { + $imgmat = imagecreatetruecolor($w, $h); + imagesavealpha($imgmat, false); + imageinterlace($imgmat, false); + imagefill($imgmat, 0, 0, imagecolorallocate($imgmat, 255, 255, 255)); + imagecopy($imgmat, $im, 0, 0, 0, 0, $w, $h); + ob_start(); + $check = @imagepng($imgmat); + if (!$check) { return $this->_imageError($file, $firsttime, 'Error creating temporary image object whilst using GD library to parse PNG image'); } + $this->_tempimg = ob_get_contents(); + $this->_tempimglnk = 'var:_tempimg'; + ob_end_clean(); + $info = $this->_getImage($this->_tempimglnk, false); + if (!$info) { return $this->_imageError($file, $firsttime, 'Error parsing temporary file image object created with GD library to parse PNG image'); } + imagedestroy($imgmat); + } + elseif ($pngalpha) { if ($this->PDFA) { $this->Error("PDFA1-b does not permit images with alpha channel transparency (".$file.")."); } $imgalpha = imagecreate($w, $h); // generate gray scale pallete