i have been trying to create a script that will read a directory and generate thumbnails for each picture in the directory. i have gotten it to the point to where i think it should work. but its not. it seems to only work for 1 picture. even if i rename that picture it breaks.. can somebody tell me what i am doing wrong? here is my code... any help would be very much appreciated.
Thanks,
Frank
<?php
$OPEN = "C:/PATH_TO_FILES/";
$handle=opendir($OPEN);
$i = 1;
while ($file = readdir($handle)) {
if ($file != "." && $file != "..") {
$size = GetImageSize($file);
$im_in = ImageCreateFromJpeg($file);
$im_out = ImageCreate($size[0] / 4, $size[1] / 4);
ImageCopyResized($im_out,$im_in,0,0,0,0,$size[0] / 4, $size[1] / 4, $size[0], $size[1]);
ImageJPEG($im_out,$i . ".jpg",90);
ImageDestroy($im_out);
ImageDestroy($im_in);
$i += 1;
}
}
?>