Commit 6dac2bc4 authored by Georg Großberger's avatar Georg Großberger Committed by Jigal van Hemert
Browse files

[BUGFIX] backColor transparent causes black background or flickering

When a GIFBUILDER object has set its backColor option to transparent,
the background may be black when adding a IMAGE object to it, and inner
areas of TEXT elements may be completly transparent, ignoring the
transparency by underlying elements.

This patch, removes the "imagealphablending" function calls, which
caused the latter issue and adds an additional check to the
tslib_stdGraphic::imagecopyresized method to prevent useage of the
imagecopyresized_fix workaround when working with transparency, as
it is responsible for the black background.

Backwards compatibility is not affected, since upgraded systems will
not have a backColor=transparent setting, thus have the property
saveAlphaLayer set to FALSE in any case.

Change-Id: I938802373b9afea03cb49a5e034d82bec0d6c664
Fixes: #32781
Releases: 6.0, 4.7, 4.6
Reviewed-on: http://review.typo3.org/9070
Reviewed-by: Wouter Wolters
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
parent 8398ffea
......@@ -297,7 +297,6 @@ class t3lib_stdGraphic {
// Preserve alpha transparency
if ($this->saveAlphaLayer) {
imagealphablending($destImg, FALSE);
imagesavealpha($destImg, TRUE);
$Bcolor = imagecolorallocatealpha($destImg, 0, 0, 0, 127);
imagefill($destImg, 0, 0, $Bcolor);
......@@ -315,7 +314,6 @@ class t3lib_stdGraphic {
$cpImg = $this->imageCreateFromFile($BBmask[3]);
$destImg = imagecreatetruecolor($w, $h);
if ($this->saveAlphaLayer) {
imagealphablending($destImg, FALSE);
imagesavealpha($destImg, TRUE);
$Bcolor = imagecolorallocatealpha($destImg, 0, 0, 0, 127);
imagefill($destImg, 0, 0, $Bcolor);
......@@ -465,7 +463,7 @@ class t3lib_stdGraphic {
* @see t3lib_iconWorks::imagecopyresized()
*/
function imagecopyresized(&$dstImg, $srcImg, $dstX, $dstY, $srcX, $srcY, $dstWidth, $dstHeight, $srcWidth, $srcHeight) {
if ($this->imagecopyresized_fix) {
if ($this->imagecopyresized_fix && !$this->saveAlphaLayer) {
// Make true color image
$tmpImg = imagecreatetruecolor(imagesx($dstImg), imagesy($dstImg));
// Copy the source image onto that
......@@ -2899,7 +2897,6 @@ class t3lib_stdGraphic {
if (function_exists('imagecreatefrompng')) {
$imageHandle = imageCreateFromPng($sourceImg);
if ($this->saveAlphaLayer) {
imagealphablending($imageHandle, FALSE);
imagesavealpha($imageHandle, TRUE);
}
return $imageHandle;
......@@ -2997,4 +2994,4 @@ class t3lib_stdGraphic {
}
}
?>
\ No newline at end of file
?>
......@@ -365,7 +365,6 @@ class tslib_gifBuilder extends t3lib_stdGraphic {
&& (empty($this->setup['format']) || $this->setup['format'] === 'png')) {
// Set transparency properties
imagealphablending($this->im, FALSE);
imagesavealpha($this->im, TRUE);
// Fill with a transparent background
......@@ -837,4 +836,4 @@ class tslib_gifBuilder extends t3lib_stdGraphic {
return $maximum;
}
}
?>
\ No newline at end of file
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment