Re: Re[2]: [PHP] cropping an image script

From: Date: Thu, 13 Mar 2003 21:20:10 +0000
Subject: Re: Re[2]: [PHP] cropping an image script
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-139600@lists.php.net to get a copy of this message
I'm getting a fatal error on the following script using MS Win 98 / Apache Server / PHP 4.1.1. / php_gd.dll Fatal error: imagecreatetruecolor(): requires GD 2.0 or later in c:\apache\htdocs\testphoto.php on line 6 Is there a workaround to this function so that I can crop part of the source .jpeg? Thank you. Tony Ritter ....................................... <? function im_crop($cropX,$cropY,$cropH,$cropW,$source,$destination,$type='jpeg') { // source image $sim = ImageCreateFromJPEG($source); // create the destination image $dim = imagecreatetruecolor($cropW, $cropH); // pass trought pixles of source image for ( $i=$cropY; $i<($cropY+$cropH); $i++ ) { for ( $j=$cropX; $j<($cropX+$cropW); $j++ ) { $pixel = imagecolorat($sim, $j, $i); imagesetpixel($dim, $j-$cropX, $i-$cropY, $pixel); } } imagedestroy($sim); ImageJPEG($dim, $destination); imagedestroy($dim); } // example im_crop(0,0,75,75,'1_data.jpeg','2_data.jpeg','jpeg'); ?> ................................ Fatal error: imagecreatetruecolor(): requires GD 2.0 or later in c:\apache\htdocs\testphoto.php on line 6 --- [This E-mail scanned for viruses by gonefishingguideservice.com]

« previous php.general (#139600) next »