martinvie Posted December 27, 2006 Share Posted December 27, 2006 Hi all,I have a problem with PHP (GD) created transparent PNG and Microsofts AlphaImageLoader.You will immediately see what the problem is if you view [url=http://www.useful-scripts.biz/test/transpng/transpng_2.php]http://www.useful-scripts.biz/test/transpng/transpng_2.php[/url] with IE 7 or Firefox and then with IE 6. It seems that the AlphaImageLoader works correctly on a PNG image that has been created with an image processor and then uploaded, but not with a PNG image created with PHP. It seems to ignore the transparent color set with PHP and instead to render the black color transparent.The image in question was created using this code:[code]<?php $source = imagecreatefrompng("parrot_orig.png");$transp = imagecolorallocate($source,255,0,0);imagecolortransparent($source,$transp);imagefilledrectangle($source,15,15,70,70,$transp);imagepng($source,"parrot_php.png");?>[/code]The HTML used on the page is this:[code]<span style="width:325;height:450px;display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='parrot_orig.png');"><img style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="parrot_php.png" width="325" height="450" border="0" alt=""></span>[/code] PHP Version 4.4.3 [GD Version] => bundled (2.0.28 compatible) [FreeType Support] => 1 [FreeType Linkage] => with freetype [T1Lib Support] => 1 [GIF Read Support] => 1 [GIF Create Support] => 1 [JPG Support] => 1 [PNG Support] => 1 [WBMP Support] => 1 [XBM Support] => 1 [JIS-mapped Japanese Font Support] => 1Any idea what could cause this problem?Thank you for considering itMartin from Vienna Link to comment https://forums.phpfreaks.com/topic/31943-php-gd-created-transparent-png-and-microsofts-alphaimageloader/ Share on other sites More sharing options...
martinvie Posted December 27, 2006 Author Share Posted December 27, 2006 *bump* Link to comment https://forums.phpfreaks.com/topic/31943-php-gd-created-transparent-png-and-microsofts-alphaimageloader/#findComment-148306 Share on other sites More sharing options...
makeshift_theory Posted December 27, 2006 Share Posted December 27, 2006 I viewed in Firefox 1.5.0.9 and I was able to view the transparent squares? Link to comment https://forums.phpfreaks.com/topic/31943-php-gd-created-transparent-png-and-microsofts-alphaimageloader/#findComment-148309 Share on other sites More sharing options...
martinvie Posted December 27, 2006 Author Share Posted December 27, 2006 That's right, in Firefox you can see the transparency. The problem is that IE prior to IE 7 cannot deal with PNG alpha transparency except with a special filter, the AlphaImageLoader. And this seems to see PHP created transparency differently somehow. Link to comment https://forums.phpfreaks.com/topic/31943-php-gd-created-transparent-png-and-microsofts-alphaimageloader/#findComment-148321 Share on other sites More sharing options...
martinvie Posted December 28, 2006 Author Share Posted December 28, 2006 *bump* Link to comment https://forums.phpfreaks.com/topic/31943-php-gd-created-transparent-png-and-microsofts-alphaimageloader/#findComment-148666 Share on other sites More sharing options...
bljepp69 Posted December 28, 2006 Share Posted December 28, 2006 Check out this user submission and the ones around it. Might help.[url=http://www.php.net/manual/en/function.imagecolortransparent.php#48912]http://www.php.net/manual/en/function.imagecolortransparent.php#48912[/url] Link to comment https://forums.phpfreaks.com/topic/31943-php-gd-created-transparent-png-and-microsofts-alphaimageloader/#findComment-148858 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.