[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

GD Module for Image Resizing

Asked by kesea in CGI Scripting, Perl Programming Language

Tags: perl

How can I (1) resize an image to 100x100, (2) overwriting the previous larger image with the new thumbnail?  When I try the code below, I get some strange looking image.  Also, do I need to check if the image $temp is a jpeg or gif and therefore (3) need to modify the second last line accordingly?

$myImage = "/$username/$temp";
$destImage = new GD::Image(100,100);
$srcImage = new GD::Image($myImage);
$destImage->copyResized($srcImage,10,10,0,0,50,50,25,25);

my $ImageLocation = "/$username/$temp";
open IMG,">$ImageLocation" or die "$ImageLocation $!";
binmode IMG;
print IMG $destImage->jpeg;
close IMG;
[+][-]02/26/08 05:38 PM, ID: 20990656Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/29/08 02:53 PM, ID: 21018363Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 / EE_QW_2_20070628