The script below does not work right. I got it from the PHP Manual. It's a script that someone wrote. You can see it about half-way down the page.
http://us3.php.net/imagecopyresized
It works real good with jpeg and png images. It doesn't work with gif and bmp images.
It downsizes jpeg and png images just fine. With gif images it doesn't do anything with the image - doesn't even touch it. With bitmaps it will wipe all of the information off of the file.
function resize_jpg($img,$w,$h){
$thumb = imagecreate ($w, $h);
$image = ImageCreateFromJPEG($img);
$imagedata = getimagesize($img);
imagecopyresized ($thumb, $image, 0, 0, 0, 0, $w, $h, $imagedata[0], $imagedata[1]);
imagejpeg($thumb, $img);
return;
}
resize_jpg("test1.jpg",100,100);
I would appreciate any assistance that anyone could provide.
Thanks