You are here: PHP (GD) created transparent PNG: AlphaImageLoader makes black parts transparent instead of transparent color set with PHP « PHP Programming Language « IT news, forums, messages
PHP (GD) created transparent PNG: AlphaImageLoader makes black parts transparent instead of transparent color set with PHP

Posted by Martin on 12/27/06 12:32

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
http://www.useful-scripts.biz/test/transpng/transpng_2.php 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:

<?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");
?>


The HTML used on the page is this:

<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>
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] => 1

Any idea what could cause this problem?
Thank you for considering it

Martin from Vienna

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация