Here is what I have, and it works nicely. But I need help creating the PNG part of it, as of right now it will only create thumbnails for jpgs.
Any help much appreciatedPHP Code:<?php
function create_thumbnail($image, $path) {
$thumb = $path . "thumb_" . $image;
$fullimage = $path . $image;
copy($image, $thumb);
list($width, $height) = getImageSize($image);
$len = strlen($thumb);
$pos = strpos($thumb,".");
$type = substr($thumb,$pos + 1,$len);
if($width > 100) {
$quotient = ceil($width/100);
$new_width = 100;
$new_height = ceil($height/$quotient);
} else {
$new_width = 100;
$new_height = $height;
}
if($type=="jpeg" || $type=="jpg") {
$destimg = ImageCreate($new_width, $new_height);
$srcimg = ImageCreateFromJPEG($thumb);
ImageCopyResized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg));
ImageJPEG($destimg, $thumb);
}
}
?>![]()






Bookmarks