First off, this is great software, and really great work done on it thus far.
It would be really cool if it could autogenerate the thumbnail images if they don't exist. I haven't gone as far as patching the existing PHP source (if not exist then autogenerate), but I've rewritten a portion of the PHP Thumbnail Generator here http://icant.co.uk/articles/phpthumbnails/ in the form of a PHP shell executable to create the thumbnails for E2.
Note that I don't use the upload system (couldn't get it to work sensibly... chmod 777 is no solution for me), but that I thought the upload system was supposed to do this.
#!/usr/bin/php
<?php
# Variables.
$source_path = \"./images/\";
$destination_path = \"./imagethumbs/\";
$thumb_width = 100;
$thumb_height = 100;
# Loop through source directory.
$handle = opendir($source_path);
while(($filename = readdir($handle)) !== false) {
# Determine source file type.
if(preg_match(\"/\.jpg$|\.jpeg$/i\", $source_path.$filename)) {
$src_img = imagecreatefromjpeg($source_path.$filename);
}
elseif(preg_match(\"/\.png$/i\", $source_path.$filename)) {
$src_img = imagecreatefrompng($source_path.$filename);
}
else {
continue;
}
# Determine dimensions of thumbnail without effecting aspect ratio.
$current_width = imageSX($src_img);
$current_height = imageSY($src_img);
if ($current_width > $current_height)
{
$scale_width = $thumb_width;
$scale_height = $current_height * ($thumb_height / $current_width);
}
if ($current_width < $current_height)
{
$scale_width = $current_width * ($thumb_width / $current_height);
$scale_height = $thumb_height;
}
if ($current_width == $current_height)
{
$scale_width = $thumb_width;
$scale_height = $thumb_height;
}
# Scale the image.
$dst_img = ImageCreateTrueColor($scale_width, $scale_height);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $scale_width, $scale_height, $current_width, $current_height);
# Determine destination file type.
if(preg_match(\"/\.jpg$|\.jpeg$/i\", $filename)) {
imagejpeg($dst_img, $destination_path.$filename);
}
elseif(preg_match(\"/\.png$/i\", $filename)) {
imagepng($dst_img, $destination_path.$filename);
}
else {
return;
}
# Clean up.
imagedestroy($dst_img);
imagedestroy($src_img);
}
?>
