Hi,

Friday, March 14, 2003, 7:20:10 AM, you wrote:
AR> I'm getting a fatal error on the following script using
AR> MS Win 98 / Apache Server / PHP 4.1.1. / php_gd.dll

AR> Fatal error: imagecreatetruecolor(): requires GD 2.0 or later in
AR> c:\apache\htdocs\testphoto.php on line 6

AR> Is there a workaround to this function so that I can crop part of the source
AR> .jpeg?
AR> Thank you.
AR> Tony Ritter
AR> .......................................
AR> <?
AR> function
AR> im_crop($cropX,$cropY,$cropH,$cropW,$source,$destination,$type='jpeg') {
AR> // source image
AR>     $sim = ImageCreateFromJPEG($source);
AR> // create the destination image
AR>     $dim = imagecreatetruecolor($cropW, $cropH);
AR> // pass trought pixles of source image
AR>     for ( $i=$cropY; $i<($cropY+$cropH); $i++ ) {
AR>         for ( $j=$cropX; $j<($cropX+$cropW); $j++ ) {
AR>            $pixel = imagecolorat($sim, $j, $i);
AR>             imagesetpixel($dim, $j-$cropX, $i-$cropY, $pixel);
AR>         }
AR>     }
AR>     imagedestroy($sim);
AR>     ImageJPEG($dim, $destination);
AR>     imagedestroy($dim);
AR> }

AR> // example
AR> im_crop(0,0,75,75,'1_data.jpeg','2_data.jpeg','jpeg');

?>>
AR> ................................

AR> Fatal error: imagecreatetruecolor(): requires GD 2.0 or later in
AR> c:\apache\htdocs\testphoto.php on line 6


AR> ---
AR> [This E-mail scanned for viruses by gonefishingguideservice.com]


What happens if you use imagecreate() ?

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to