Click to See Complete Forum and Search --> : Image treating and errors, lot of errors!


Perfidus
11-10-2003, 10:05 AM
I'm trying this and I get as many errors as I have never seen together in my life:

echo "FICHIER=$file<br>\n"; //gives the temporary name of our file
echo "TMP=$file_tmp<br>\n"; // same as $file.
echo "TYPE=$file_type<br>\n"; // gives the MIME type of our file (image/jpeg or image/gif)
echo "NAME=$file_name<br>\n"; //gives the name of the uploaded file

$repertoire = "tmp/"; // path to the temp directory
$repertoire2 = "img/"; // path to the image directory
$destination = $repertoire2.$file_name; //destination of the file img/filename.jpg

echo "TEXTE=$pic_comment<br>\n"; //print our picture description - this is what we have written in the form (textarea name="pic_comment")
echo "TEXTE=$pic_title<br>\n"; //print the title of our picture (input type="text" name="pic_title")
if (!move_uploaded_file($file, $destination)) {echo "ERROR: Impossible to move the file: $file to $destination";} //file is moved from temp to img
?>
<?
$file = "www.costa4seasons.com/picture/img/" . $file_name; //this should be the absolute path to your uploaded file
$split = split("\.", $file);
$name = $split[0];
$image = ImageCreateFromJPEG($file); //copy of the uploaded image
$width = imagesx($image) ; //size verification
$height = imagesy($image) ; //size verification

$new_width = 50; //we specify the width for our thumbnail... here 50 pixel
$new_height = ($new_width * $height) / $width ; // get the apropriate height

$thumb = imagecreate($new_width,$new_height); // creation of a white 50 pixel wide thumb

imagecopyresized($thumb,$image,0,0,0,0,$new_width,$new_height,$width,$height); // thumb is now created on the white canvas

ImageJPEG($thumb, $name."_thumb.jpg"); // gives the MIME type to the file (jpeg, gif or png) and add _thumb.jpg to the file name.

imagedestroy($image); // destroy our copy of the uploaded image



This is to upload and create thumbnail.
But I get the following errors, it proceses datas from a form.

FICHIER=/temp//tmp/php0DaYxf
TMP=
TYPE=image/pjpeg
NAME=feo7varios.jpg
TEXTE=jkm,g,l yill
TEXTE=uuo
ERROR: Impossible to move the file: /temp//tmp/php0DaYxf to img/feo7varios.jpg
Warning: imagecreatefromjpeg(www.costa4seasons.com/picture/img/feo7varios.jpg): failed to open stream: No such file or directory in /chs/p1/costa4seasons.com/home/html/picture/upload_process.php on line 23

Warning: imagesx(): supplied argument is not a valid Image resource in /chs/p1/costa4seasons.com/home/html/picture/upload_process.php on line 24

Warning: imagesy(): supplied argument is not a valid Image resource in /chs/p1/costa4seasons.com/home/html/picture/upload_process.php on line 25

Warning: Division by zero in /chs/p1/costa4seasons.com/home/html/picture/upload_process.php on line 28

Warning: imagecreate(): Invalid image dimensions in /chs/p1/costa4seasons.com/home/html/picture/upload_process.php on line 30

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /chs/p1/costa4seasons.com/home/html/picture/upload_process.php on line 32

Warning: imagejpeg(): supplied argument is not a valid Image resource in /chs/p1/costa4seasons.com/home/html/picture/upload_process.php on line 34

Warning: imagedestroy(): supplied argument is not a valid Image resource in /chs/p1/costa4seasons.com/home/html/picture/upload_process.php on line 36

DaiWelsh
11-11-2003, 10:56 AM
All the rrors stem from the first

ERROR: Impossible to move the file: /temp//tmp/php0DaYxf to img/feo7varios.jpg

fix that error and the rest will disappear ;)