php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19133 imagecopymerge doesn't work correctly in gd2
Submitted: 2002-08-27 16:40 UTC Modified: 2002-10-07 15:06 UTC
From: dhunter at ssesco dot com Assigned:
Status: Closed Package: GD related
PHP Version: 4.2.3 OS: Win2K
Private report: No CVE-ID: None
 [2002-08-27 16:40 UTC] dhunter at ssesco dot com
Merging transparent PNGs does not work correctly with php_gd2.  The "top" image totally obscures the underlying image.  Expected image would be the same as layering separate transparent PNG files in IE with CSS.


This works correctly in php_gd

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-27 22:16 UTC] sniper@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
 [2002-08-28 11:11 UTC] dhunter at ssesco dot com
Same behavior for PHP versions 4.1.2 and 4.2.2
 [2002-08-28 12:27 UTC] kalowsky@php.net
sample script?
 [2002-08-28 13:02 UTC] dhunter at ssesco dot com
Sample script:

<?php

$Png0 = "c:\\thumbs\\TERRAIN_color_big.PNG";
$Png1 = "c:\\thumbs\\Z00_LYR3_MAP_T_STATES_CYAN.png";
$Png2 = "c:\\thumbs\\eta_big.png";
$Timg= "c:\\thumbs\\test.png";

$Tim0= ImageCreateFromPng($Png0);
$Tim1= ImageCreateFromPng($Png1);
$Tim2= ImageCreateFromPng($Png2);

ImageCopyMerge($Tim0,$Tim1,0,0,0,0,649,548,100);
ImageDestroy($Tim1);
ImageCopyMerge($Tim0,$Tim2,0,0,0,0,649,548,100);
ImageDestroy($Tim2);
ImagePng($Tim0,$Timg);
ImageDestroy($Tim0);

?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<STYLE><!--
.LYR0 {position: absolute; TOP:800; LEFT:10;z-Index:0; }
.LYR1 {position: absolute; TOP:800; LEFT:10;z-Index:1; }
.LYR2 {position: absolute; TOP:800; LEFT:10;z-Index:2; }
--></style>
</head>
<body>

<!-- display the composite image -->
<img src=<?php echo "$Timg"; ?>><br><br>

<!-- for comparison, display the PNGs layered atop one another -->
<span class=LYR0><img src=<?php echo "$Png0"; ?>></span>
<span class=LYR1><img src=<?php echo "$Png1"; ?>></span>
<span class=LYR2><img src=<?php echo "$Png2"; ?>></span>

</body>
</html>


Note that with php_gd2, the composite image "$Timg" ends up identical to $Png3.  With php_gd, it looks identical to the three PNGs layered atop one another using CSS (which is what I believe to be the proper behavior).
 [2002-08-28 13:57 UTC] sander@php.net
This might be fixed with the bundled verion of GD2 available with 4.3.0. Please try a snapshot from http://snaps.php.net.
 [2002-08-29 16:32 UTC] dhunter at ssesco dot com
Sorry, we have to stick with version 4.2.2 for now.  

Can anyone think of any possible workarounds?
 [2002-10-06 02:08 UTC] rasmus@php.net
I verified that this works correctly in the bundled GD2 in PHP 4.3.
 [2002-10-07 14:13 UTC] dhunter at ssesco dot com
I tried this in 4.2.3, and my tests still fail.  Can you tell me what you did in your tests?
 [2002-10-07 15:06 UTC] rasmus@php.net
I said 4.3, not 4.2.3.  I used 4.3 built using --with-gd=php

In 4.3 we forked the GD library so we could start fixing some of the oodles of bugs in it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 21:01:33 2024 UTC