I have this function:
<?php
$new_width=100; //Image width Change if needed
$new_height=100; //Image height Change if needed
$source_path="../random/images"; //Source File path
$destination_path="../random/thumbs";
function thumb_jpg($file)
{
global $source_path;
global $destination_path;
global $new_width;
global $new_height;
$destimg=ImageCreate($new_width,$new_height) or die("Problem In Creating image");
$srcimg=ImageCreateFromJPEG($source_path.$image_name) or die("Problem In opening Source Image");
ImageCopyResized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die("Problem In resizing");
ImageJPEG($destimg,$destination_path.$image_name) or die("Problem In saving");
}
?>
That creates a thumbnail of an image uploaded from a form.
I get the following errors however:
Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/arctichosts/public_html/admin/admin_uploadrandom.php on line 24
Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: ‘…/random/images’ is not a valid JPEG file in /home/arctichosts/public_html/admin/admin_uploadrandom.php on line 24
Problem In opening Source Image
I have GDv2.0.28.
Any ideas?