diff -u -ru typo3_src-4.0beta3/t3lib/class.t3lib_stdgraphic.php typo3_src-4.0beta3.gifbuilder/t3lib/class.t3lib_stdgraphic.php --- typo3_src-4.0beta3/t3lib/class.t3lib_stdgraphic.php 2006-02-16 01:00:10.000000000 +0100 +++ typo3_src-4.0beta3.gifbuilder/t3lib/class.t3lib_stdgraphic.php 2006-03-09 03:45:03.150302424 +0100 @@ -2650,7 +2650,7 @@ case 'png': if ($this->ImageWrite($this->im, $file)) { // ImageMagick operations - if ($this->setup['reduceColors'] || !$this->png_truecolor) { + if ($this->setup['reduceColors'] || (!$this->png_truecolor && $this->truecolor)) { $reduced = $this->IMreduceColors($file, t3lib_div::intInRange($this->setup['reduceColors'], 256, $this->truecolorColors, 256)); if ($reduced) { @copy($reduced, $file); diff -u -ru typo3_src-4.0beta3/typo3/sysext/cms/tslib/class.tslib_gifbuilder.php typo3_src-4.0beta3.gifbuilder/typo3/sysext/cms/tslib/class.tslib_gifbuilder.php --- typo3_src-4.0beta3/typo3/sysext/cms/tslib/class.tslib_gifbuilder.php 2006-02-16 01:00:10.000000000 +0100 +++ typo3_src-4.0beta3.gifbuilder/typo3/sysext/cms/tslib/class.tslib_gifbuilder.php 2006-03-09 03:12:22.499366672 +0100 @@ -176,14 +176,17 @@ } if (!$this->setup['backColor']) { $this->setup['backColor']='white'; } - // Transparent GIFs - // not working with reduceColors - // there's an option for IM: -transparent colors if ($conf['transparentColor.'] || $conf['transparentColor']) { $cObj =t3lib_div::makeInstance('tslib_cObj'); $cObj->start($this->data); $this->setup['transparentColor_array'] = explode('|', trim($cObj->stdWrap($this->setup['transparentColor'], $this->setup['transparentColor.']))); } + + // Transparency does not properly work when, GIFs or 8-bit PNGs are generated or reduceColors is set -- disable truecolor flag so they get generated "natively" in 8-bit. + // not working with reduceColors and truecolor images + if (($this->setup['transparentBackground'] || is_array($this->setup['transparentColor_array'])) && ($this->gifExtension=='gif' || !$this->png_truecolor || isset($this->setup['reduceColors']))) { + $this->truecolor = false; + } // Set default dimensions if (!$this->setup['XY']) {$this->setup['XY']='120,50';} @@ -441,7 +444,7 @@ } elseif (is_array($this->setup['transparentColor_array'])) { // Multiple transparent colors are set. This is done via the trick that all transparent colors get converted to one color and then this one gets set as transparent as png/gif can just have one transparent color. $Tcolor = $this->unifyColors($this->im, $this->setup['transparentColor_array'], intval($this->setup['transparentColor.']['closest'])); - if ($Tcolor) { + if ($Tcolor>=0) { imagecolortransparent($this->im, $Tcolor); } }