#19418 [Opn]: ImageCreateFromGD2Part() creates invalid img resource
ID: 19418
User updated by: sprice@wisc.edu
-Summary: ImagePNG() error
Reported By: sprice@wisc.edu
Status: Open
Bug Type: GD related
Operating System: Darwin (Mac OS X)
PHP Version: 4.2.3
New Comment:
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 );
?>
Previous Comments:
------------------------------------------------------------------------
[2002-09-15 12:58:13] sprice@wisc.edu
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
Thread (3 messages)