Hi,
I have a fairly good script to create thumbnails of my photos, however I can't get it to make square thumbnails... it always makes thumbs that are relative to the original image.
So, I thought I could resize the image to the required thumb, then grab the middle part of it for the square.
$new_w="90";
$new_h="90";
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img = @imageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
imagejpeg($dst_img,$filename,90);
imagedestroy($dst_img);
imagedestroy($src_img);
Can anyone see how to do this using the script a friend made me?
I have tried dozens of different methods, read up on php.net, but in the end thought someone might know how to fix it in just a few minutes.
Thanks