By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,889 Members | 1,044 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,889 IT Pros & Developers. It's quick & easy.

Png transparency

P: n/a
I've been trying to just open a png and display it, that way:

<?
header ("Content-type: image/png");
$im = imagecreatefrompng('empty.png');
imagepng($im);
?>

But the transparency is not kept. I did try in netscape too,
but it's visible even in explorer, when comparing how the
direct image looks and how it looks when thru the script, that
transparency was killed.

Ideas (on how to solve or at least which, from
imagecreatefrompng or imagepng, kills the transparency) ?
I got php 4.3.1 and the bundled GD of it.
Jul 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Cecile Muller wrote:
I've been trying to just open a png and display it, that way:

<?
header ("Content-type: image/png");
$im = imagecreatefrompng('empty.png');
imagepng($im);
?>

But the transparency is not kept. I did try in netscape too,
but it's visible even in explorer, when comparing how the
direct image looks and how it looks when thru the script, that
transparency was killed.

Ideas (on how to solve or at least which, from
imagecreatefrompng or imagepng, kills the transparency) ?
I got php 4.3.1 and the bundled GD of it.


If it worked in Netscape, and not explorer, that's normal. However,
there is a workaround you can use in the image tag:

http://www.koivi.com/ie-png-transparency/

HTH

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 16 '05 #2

P: n/a
I had the same problem. If you create the .png as a 'true color' graphic,
it will not be transparent. When I created the same graphic using a '256
color' palatte, transparency worked fine.

Pat Scott
"Cecile Muller" <sp**@wildpeaks.com> wrote in message
news:af**************************@posting.google.c om...
I've been trying to just open a png and display it, that way:

<?
header ("Content-type: image/png");
$im = imagecreatefrompng('empty.png');
imagepng($im);
?>

But the transparency is not kept. I did try in netscape too,
but it's visible even in explorer, when comparing how the
direct image looks and how it looks when thru the script, that
transparency was killed.

Ideas (on how to solve or at least which, from
imagecreatefrompng or imagepng, kills the transparency) ?
I got php 4.3.1 and the bundled GD of it.

Jul 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.