Skip to content
Snippets Groups Projects
Commit ba20cfd6 authored by Jared Hancock's avatar Jared Hancock
Browse files

Don't process alpha channel of PNG images

parent 2c7e2fd8
No related branches found
No related tags found
No related merge requests found
......@@ -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;
?>
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment