Thanks for the code, usermike - it works great until it hits certain files - I don't know if they're corrupt, non-jpeg, etc. but at least on HAS the jpg ext.
Questions:
1. Is there way to work around this so that it processes the rest of the images? I modified the code (see below) and now get a similar series of errors on png...
2. I want to post all images to a directory rather than to a db from now on. I have been testing in skin1/main/product_modify.php - are there any other files affected?
Thanks for your help... smileyzoo
/* code to include imagecreatefrompng
function thumbnail($image_path,$thumb_path,$image_name,$thu mb_width)
{
if ($image_type =="image/pjpeg") {
$src_img = imagecreatefromjpeg("$image_path/$image_name");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
$new_w = $thumb_width;
$diff=$origw/$new_w;
$new_h=$origh/$diff;
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w, $new_h,imagesx($src_img),imagesy($src_img));
//change 100 to something smaller for a smaller file size, lower quality image
imagejpeg($dst_img, "$thumb_path/$image_name", 100);
return true;
} else {
$src_img = imagecreatefrompng("$image_path/$image_name");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
$new_w = $thumb_width;
$diff=$origw/$new_w;
$new_h=$origh/$diff;
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w, $new_h,imagesx($src_img),imagesy($src_img));
//change 100 to something smaller for a smaller file size, lower quality image
imagepng($dst_img, "$thumb_path/$image_name", 100);
return true;
}
}
*/