Hi,
Thanks in advance for any assistance with a script that was working fine yesterday and seems to have fallen over for reasons I can’t get a fix on.
Script should allow me to upload images and save a copy in three widths.
Excerpt from script:
ShowProduct ($product_id);
$full_size_image_width=580;
$featured_size_image_width=290;
$small_image_width=200;
$new_image_id=GetNewImageID ();
if( isset($_POST['submit']) ) {
$image_count=ImageCount ($product_id, $Images_Unique_Ref);
if ($image_count==0) {
$image = new SimpleImage();
$image->load($_FILES['uploaded_image']['tmp_name']);
$image->resizeToWidth($full_size_image_width);
$image->save('../dev/product_images/full_size/'.$new_image_id.'.jpg');
$image->resizeToWidth($featured_size_image_width);
$image->save('../dev/product_images/featured_size/'.$new_image_id.'.jpg');
$image->resizeToWidth($small_image_width);
$image->save('../dev/product_images/reduced_size/'.$new_image_id.'.jpg');
InsertNewImageID ($new_image_id, $product_id, $Images_Unique_Ref);
}
Excerpt from class
class SimpleImage {
var $image;
var $image_type;
function load($filename) {
$image_info = getimagesize($filename);
$this->image_type = $image_info[2];
if( $this->image_type == IMAGETYPE_JPEG ) {
$this->image = imagecreatefromjpeg($filename);
} elseif( $this->image_type == IMAGETYPE_GIF ) {
$this->image = imagecreatefromgif($filename);
} elseif( $this->image_type == IMAGETYPE_PNG ) {
$this->image = imagecreatefrompng($filename);
}
}
As I say, have had it working but now getting error messages. First is:
Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in
There are other messages but I think the rest are all arising from this failure to get a filename to work on the uploaded file.
Any ideas would be gratefully received.