php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25540 Transparency is not working
Submitted: 2003-09-15 05:23 UTC Modified: 2003-09-15 18:33 UTC
From: guido at comlog dot nl Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.3 OS: W2K
Private report: No CVE-ID: None
 [2003-09-15 05:23 UTC] guido at comlog dot nl
Description:
------------
Transparency is not working on PNG files on W2K.
I've tried a few background colors, different formats, but can't get it working.

Reproduce code:
---------------
<?php

// Example demonstrating a transparent truecolor png bug
// fixed by the time of gd 2.0.11, but not fixed in php's
// bundled gd.

header("Content-type: image/png");

$image = imageCreateTruecolor(640, 100);

$transparent = imageColorAllocate($image, 0, 0, 0);
$red = imageColorAllocate($image, 255, 50, 50);
imageColorTransparent($image, $transparent);

imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent);

imageString($image, 3, 0, 0, "If the background is black, and you aren't on win32 IE (buggy png code), this is a bug.", $red);

imagePng($image);

?>

Expected result:
----------------
The code should produce a white PNG image with red text.

Actual result:
--------------
The code produces a black PNG image with red text. The background is NOT transparent.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-15 18:33 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You are probably using a browser Internet Explorer that does not support tranparency in png correctly. The generated image works fine in Mozilla on Win32 and *NIX.
 [2004-05-13 01:35 UTC] areyesa at elektra dot com dot mx
I did something similar... I compile the enviroment with php 4.3.x and I had no transparency support in iexplorer (I had transparency support in mozilla browser)... but,
if I compile the same environment with php 4.2.3 I do have transparency support in iexplorer and mozilla

I'm on redhat linux 7.3 and compile php from official php.net
 [2004-06-13 21:12 UTC] rombert at go dot ro
I have the same issue with a Linux server, with PHP 4.3.7 compiled from source.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 11:01:31 2024 UTC