It seems libgd development has started up again, so I'll toss my
truecolor fixes onto the pile.  Some were already fixed in the version
that comes with PHP-4.3.0 (I had originally patched against gd 2.0.1
beta), so these are the remaining issues I know of against PHP 4.3.0's
dist.
The patch is here: http://www-cs.ucsd.edu/~sbrown/php-4.3.0-gd-swb.patch
.

This fixes truecolor PNG image loading trying to extract the
transparency colors from the boolean trueColor flag rather than the
transparent color, fixes a few issues in the truecolor->palette code
with how transparency is handled, and adds gd's imageSaveAlpha to PHP.
I also changed a fix that went in that looked like it wasn't fixed quite
right, gd.c's image copy throwing out alpha when copying palette to
truecolor.  Very few browsers support alpha transparent PNGs so
imageSaveAlpha must be set false to generate boolean transparency.  PHP
4.3.0 (or its included gd) seems to default this to false now anyway (gd
used to default to true).

TrueColor PNG boolean transparency works great in all modern browsers
except desktop win32 IE.  It's your enemy on this.  Funny thing is, IE
3.02 for the Pocket PC works beautifully.  Go figure.  Also, unless it's
been changed since I first wrote this, gd in truecolor mode always
assigns color 0 as black (0,0,0).  IE (5+6) always take color index 0 as
transparent regardless of what index you tell it to use it seems, so the
hack is to always set black as your transparent color so transparent
palettized PNGs will work.  Rather than fix these issues, Microsoft has
some hacky IE-specific DirectX HTML goo
(http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html) to load
transparent truecolor PNGs.  Problem is, it's also buggy and won't work
with HTTPS addresses last I tried!  If you need to spit transparent
truecolor PNGs out over HTTPS, you need to browser detect these
PNG-challenged IEs and do a imageTrueColorToPalette to dither it down to
a palettized PNG right before you output it until Microsoft gets around
to fixing these major brokennesses in IE.  Otherwise you can browser
detect and use that DirectX hack.

If you've got questions on how to get truecolor transparent PNGs to work
in your own code, I could throw together some sample code.  With this
patch in and those workarounds, it's working great for me.


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to