I've got a small chunk of script for uploading an image and then creating a thumbnail of this and uploading this too.
Trouble is the both work when on their own, but combine them together and you get the following error:
Code: Select all
Warning: imagecreatefromjpeg(c:/wamp/tmp\php277.tmp) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in C:\wamp\www\stella\admin.php on line 68Here's the code:
Code: Select all
$image = $_FILES['image']['name'];
$tmp = $_FILES['image']['tmp_name'];
$dir = opendir("portfolio/" . $section . "/");
move_uploaded_file($tmp, "portfolio/" . $section . "/" . $image)
or die("Could not copy: " . $section . "/" . $image);
$img = imagecreatefromjpeg($tmp);
$tmp_img = imagecreatetruecolor( 45, 45 );
imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, 45, 45, imagesx( $img ), imagesy( $img ));
imagejpeg( $tmp_img, "portfolio/" . $section . "/thumbs/" . $image );
closedir( $dir );Thanks a bunch.