|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 12:00:02 2025 UTC |
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).