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($s
rcImage,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;