Bug #23236
closed
Generation transparent images with GMENU fails
Added by Marius Muehlberger almost 14 years ago.
Updated over 5 years ago.
Description
After updating from TYPO3 4.3.X (everything works fine) - the images generated via GMENU are not transparent any more.
Does not work in 4.4.0, changing back to 4.3.X everything is fine again.
ImageMagick Version is 4.2.9.
Example-Code:
lib.nav.main.1 {
NO = 1
NO {
XY = [30.w]+30, 31
format = gif
backColor = #000000
transparentColor = #000000
## no effect (works in 4.3.X, not in 4.4.0):
#transparentColor.closest = 1
## use instead transparentColor of no effect (works in 4.3.X, not in 4.4.0):
#transparentBackground = 1
wrap= |
10 = IMAGE
10 {
file = fileadmin/tpl/menu/nact-back.b.gif
align = l,t
}
30 = TEXT
30 {
text.field = title
fontColor = #ffffff
fontFile = fileadmin/tpl/menu/myfont.ttf
fontSize = 12
offset = 0 , 22
align = center
niceText = 0
}
}
(issue imported from #M15184)
Files
I can confirm this bug.
In TYPO3 4.4 the function "makeText" in class.t3lib_stdgraphic.php was modified, so images are created with the function "imagecreatetruecolor". When I change this back to "imagecreate", everything works fine again.
Tested with GM 1.1.6, GM 1.1.11, ImageMagick 4.2.9 and ImageMagic 6 on Debian Lenny systems.
Thanks for this research, Torben. I have the same problem. In <= 4.4, a GIFBUILDER graphic with niceText = 1 and transparentBackground = 1 had #FAFCFA as "transparent" which is pretty close to #FFFFFF.
In 4.4 with same configuration "transparent" is #FAFCFA which is clearly different from #FFFFFF.
In my testcase turning niceText on or off does not influence the problem (neither reduceColors, but this feature is deprecated/obsolete anyway).
Also using black or white as transparent color (which often remain #ffffff or #000000) does not help to solve the problem.
Output color in the example TS above really is #000000, but the image created only is transparent in TYPO3 4.3
In my system, turning niceText off and antiAlias on (which is on by default), the background is #FFFFFF. But niceText off has the best rendering result with the font size I'm using.
Just tried out: The bug remains in 4.4.1 :(
I doubt that it's a bug, it's just an inconvinience... the change was done with #22687. GD1 support was dropped so True Color images are now generated by default.
And by the way, it's mentioned in TSref that transparentBackground and niceText may not work together properly ("NOTE: You may experience that this doesn't work if you use reduceColors-option or render text with niceText-option.")
Still I wonder if it's really impossible to have a white background in a niceText image.
I read this note before creating this bug. I have turned of niceText and still only get transparent images in T3 v. 4.3
30 = TEXT
30 {
[...]
niceText = 0
}
I finally figured this out.
It seems, that TYPO3 4.4 canĀ“t create transparent GIF-images using the Gifbuilder.
When I configure TYPO3 to create PNG-images instead of GIF-images, the transparency of Gifbuilder-Images works fine again.
Set the following in your localconf.php
[GFX][gdlib_png] = 1
Hope this helps.
Thanks for that hint! But it still remains a bug, creating gif's should be possible anyway - using png's is not a solution.
Internet Explorer 6 does not support transparent png's and the sad thing is that 7% of our visitors still use this dinosaur...
I can confirm this bug with TYPO3 4.4.
Confirmed for TYPO3 4.4.2 and ImageMagick 6.3.7.
Confirmed for tranparentColor and for transparentBackground.
Adding "format = png" (or the GFX var as Torben said) generates transparent PNGs as expected, GIFs just get a solid black (although the backColor is some blue) background.
Changing a flag - which at the first glance has nothing todo with gif-generation - solved the problem for me:
$TYPO3_CONF_VARS['GFX']['png_truecolor'] = '1'
(default is 0)
Could confirm this on two installations so far; Don't forget to clean up typo3temp/menu and cached image sizes via install tool.
Transparent gif's are back :)
Problem solved? Can anyone confirm this manner?
When I just enable PNG Truecolor as Marius wrote, GIF-Images are still not rendered with transparent background. I have tested this on several (existing) installations, cleaned all caches and deleted alle temp-files in typo3temp/
In my opinion it can only work (and it does!) when
[GFX][gdlib_png] = 1 AND
[GFX][png_truecolor] = 1
are enabled. With these configs I finally got transparent headers/menus back.
In my case it is:
[GFX][gdlib_png] = 0
[GFX][png_truecolor] = 1
because I need a transparent GIF output!
[GFX][gdlib_png] = 1
would disable GIF-output.
If you need an example send me a message: mm (at) co-operation (dot) de
Solution is much more simple:
Benni changed the way T3LIB_StdGraphic handles files internally to truecolor some time back.
GIFBUILDER uses ImageColorExact to determine the transparent color value which is only available in images that use palettes (which trueColor do not).
See attachted patch for fixing the stuff
This explanation makes sence. Although the other way worked in several installations for me. Will the patch be included in new versions?
pending in core list... le'ts wait and see :)
The fix by Mathias Schreiber was committed this to:
- trunk rev 9316 (will be in 4.5.0 beta1)
- TYPO3_4-4 rev 9317 (will be in 4.4.5)
- Target version deleted (
1088)
- Status changed from Resolved to Closed
Also available in: Atom
PDF