ID: 19418 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: GD related Operating System: Darwin (Mac OS X) PHP Version: 4.2.3 New Comment:
Sorry, but the bug system is not the appropriate forum for asking support questions. 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 Thank you for your interest in PHP. This problem is not the fault of PHP. After trying your script I found that gd sends the following errors to stderr (you can most likely find them in Apache's error_log). gd-png: fatal libpng error: Invalid number of colors in palette gd-png error: setjmp returns error condition void Which is why a corrupt image you are seeing gets created. Previous Comments: ------------------------------------------------------------------------ [2002-09-18 20:25:11] [EMAIL PROTECTED] If I copy the image to a new image resource, I can use ImagePNG() just fine. I am changing the summerey to reflect that this is a ImageCreateFromGD2Part() error and not a ImagePNG() error. This is the changed script that works just fine: <?php header( "Content-type: image/png" ); header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header( "Cache-Control: no-store, no-cache, must-revalidate" ); header( "Pragma: no-cache" ); $medimg = $_SERVER['DOCUMENT_ROOT'] . "/riverdata/images/world_map_med.gd2"; $medimg = ImageCreateFromGD2Part( $medimg, 1, 1, 800, 600 ); $img = ImageCreateTrueColor( 800, 600 ); ImageCopy( $img, $medimg, 0, 0, 0, 0, 800, 600 ); ImageDestroy( $medimg ); //Send it out. ImagePNG( $img ); ImageDestroy( $img ); ?> ------------------------------------------------------------------------ [2002-09-15 12:58:13] [EMAIL PROTECTED] Here is the script that I am trying to run: <?php header( "Content-type: image/png" ); header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header( "Cache-Control: no-store, no-cache, must-revalidate" ); header( "Pragma: no-cache" ); $medimg = $_SERVER['DOCUMENT_ROOT'] . "/riverdata/images/world_map_med.gd2"; $img = ImageCreateFromGD2Part( $medimg, 1, 1, 800, 600 ); //Send it out. ImagePNG( $img ); ImageDestroy( $img ); ?> When I load this script from the browser Chimera, it fails with the error "The image �http://144.92.10.251/riverdata/test.php� cannot be displayed, because it contains errors." When I load this script from the browser OmniWeb, it fails with this error "Cannot Load Address; Attempted read off end of buffer" I tried changing "ImagePNG( $img );" to "ImageJPEG( $img );" and the content-type header to jpeg, and then it works. ImagePNG() works in the rest of my scripts, which leads me to believe that it may be a problem with the data recieved from ImageCreateFromGD2Part(). If you want a .gd2 image for testing, you can use "http://144.92.10.251/riverdata/images/world_map_med.gd2". It is a 20 meg file of the earth. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19418&edit=1
