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-10 01:59:26.113242136 +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); @@ -2835,7 +2835,7 @@ * @return integer The index of the unified color */ function unifyColors(&$img, $colArr, $closest = false) { - $retCol = false; + $retCol = -1; if (is_array($colArr) && count($colArr) && function_exists('imagepng') && function_exists('imagecreatefrompng')) { $firstCol = array_shift($colArr); $firstColArr = $this->convertColor($firstCol); 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-10 01:59:53.056146192 +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';} @@ -437,11 +440,12 @@ if ($this->setup['transparentBackground']) { // Auto transparent background is set + $Bcolor = ImageColorExact($this->im, $BGcols[0],$BGcols[1],$BGcols[2]); imagecolortransparent($this->im, $Bcolor); } 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); } }