I have encountered the following errors:
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/fhlinux197/r/rupstar.com/user/htdocs/fupload.php on line 20
and
Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/fhlinux197/r/rupstar.com/user/htdocs/fupload.php on line 21
I have the following script:
<?php
header('Content-type: image/jpeg');
$file_dir = "/home/fhlinux197/r/rupstar.com/user/htdocs/images";
$file_url = "http://www.rupstar.com/images/";
print "path: $fupload<br>\n";
print "name: $fupload_name<br>\n";
print "size: $fupload_size bytes<br>\n";
print "type: $fupload_type<p>\n\n";
copy ( $fupload, "$file_dir/$fupload_name" ) or die ("Couldn't copy");
$width = 320;
$height = 320;
list($width_orig, $height_orig) = getimagesize($fupload);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($fupload);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, '', 60);
?>
Line 20 reads:
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
Line 21 reads:
imagejpeg($image_p, '', 60);
Your help is much appreciated as always!!!!!
Rupert