Forum Moderators: coopster
I deleted the thumnails (leaving the original image files) and the script broke! What good is that? Does anyone know of a way to really create thumbnails using PHP?
function make_thumbnail($image, $thumb)
{
# $image is the path to the orignal image
# $thumb is the path to the thumbnail we're going to create# Get the size of the original image
$size = getimagesize($image);
$width = $size[0];
$height = $size[1];# Shrink it to 25%
$width = $width / 4;
$height = $height / 4;# Read the image, resize it, and save the thumbnail
if (file_exists($thumb)) {
unlink($thumb);
}$dst_img = ImageCreateTrueColor($width, $height);
$src_img = ImageCreateFromJpeg($image);
ImageCopyResized($dst_img, $src_img, 0, 0, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img));ImageJpeg($dst_img, $thumb);
}