i've looked over the manual, but i just don't understand one (important) detail..
how do i make my $imagefile (for example, image1.jpg) a "valid Image resource" ??
here are my error msgs:
Warning: Supplied argument is not a valid Image resource in /home/kdavis/www/images/functions.inc on line 969
Warning: Supplied argument is not a valid Image resource in /home/kdavis/www/images/functions.inc on line 969
Warning: Supplied argument is not a valid Image resource in /home/kdavis/www/images/functions.inc on line 969
Warning: Supplied argument is not a valid Image resource in /home/kdavis/www/images/functions.inc on line 976
and here is my function:
function resizeimage($new_dir, $imagefile) {
// precondition: $imagefile must contain full path such as "/home/kdavis/www/images/image1.jpg"
chdir($new_dir);
$new_w = "75";
$new_h = "75";
$src_img = getimagesize($imagefile);
$src_imagewidth = $src_img[0];
$src_imageheight = $src_img[1];
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$imagefile,0,0,0,0,$new_w,$new_h,imagesx($src_imagewidth),imagesy($src_imageheight));
chdir("thumbnails/");
if ( file_exists("thumb_" . $imagefile) ) {
unlink("thumb_" . $imagefile);
}
imagejpeg($dst_img,"thumb_$imagefile");
ImageDestroy($src_img);
ImageDestroy($dst_img);
}
thanks 🙂