Hi,
ok, I have this script that is supposed to make images into thumbnails. It doesn't work. I have GD v. 2.0 installed on the server. Can anyone tell me why it doesn't work?
Here is the code:
<?PHP
if ($REQUEST_METHOD=="POST") {
$new_w = 75;
$new_h = 50;
$cfg_fullsizepics_path = "../images/$galleryselect/full";
$cfg_thumb_path = "../images/$galleryselect/thumbs";
$filepath = "../images/$galleryselect/full/";
$dir = dir($filepath);
while($entry=$dir->read()) {
if($entry == "." || $entry == "..") {
continue;
}
$fp = @fopen("$filepath/$entry","r");
$photo_filename = "$entry";
$image_stats = GetImageSize($cfg_fullsizepics_path."/".$entry);
$imagewidth = $image_stats[0];
$imageheight = $image_stats[1];
$img_type = $image_stats[2];
$ratio = ($imagewidth / $new_w);
if (!file_exists($cfg_thumb_path."/".$entry)) {
if ($img_type=="2") {
$src_img = newFromJpeg($cfg_fullsizepics_path."/".$entry);
$dst_img = newFromJpeg($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img, "$cfg_thumb_path"."/$entry");
} elseif ($img_type=="3") {
$dst_img=ImageCreate($new_w,$new_h);
$src_img=ImageCreateFrompng($cfg_fullsizepics_path."/".$entry);
ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
Imagepng($dst_img, "$cfg_thumb_path"."/$entry");
} elseif ($img_type=="1") {
$cfg_thumb_url=$cfg_fullsizepics_url;
}
}
}
echo "Thumbnails created!";
}
?>
Here are the errors I get:
Warning: Wrong parameter count for imagecreate() in /home/dhill/public_html/myfiles/admin/gallery_edit.php on line 448
Warning: imagesx(): supplied argument is not a valid Image resource in /home/dhill/public_html/myfiles/admin/gallery_edit.php on line 450
Warning: imagesy(): supplied argument is not a valid Image resource in /home/dhill/public_html/myfiles/admin/gallery_edit.php on line 450
Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home/dhill/public_html/myfiles/admin/gallery_edit.php on line 450