Jump to content


Photo

Help with image resizing


  • Please log in to reply
1 reply to this topic

#1 herando

herando
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 25 May 2006 - 07:45 AM

hi all,

i choose a image file from form field and upload. but the browser shows such errors:
Notice: Undefined variable: uploadfile in c:\program files\apache group\apache\htdocs\u-r\upload.php on line 20

Notice: Undefined variable: uploadfile in c:\program files\apache group\apache\htdocs\u-r\upload.php on line 23

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in c:\program files\apache group\apache\htdocs\u-r\upload.php on line 37

Notice: Undefined index: uploadfile in c:\program files\apache group\apache\htdocs\u-r\upload.php on line 42

Warning: imagedestroy(): supplied argument is not a valid Image resource in c:\program files\apache group\apache\htdocs\u-r\upload.php on line 45

could anyone help me, please. here is the resizing code:

<?php
$uploadedfile = $_FILES['uploadfile']['tmp_name'];
$src = imagecreatefromjpeg($uploadfile);
list($width,$height)=getimagesize($uploadfile);

$newwidth=260;
$newheight=195;
$tmp=imagecreatetruecolor($newwidth,$newheight);

imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

$filename = "../images". $_FILES['uploadfile']['name'];

imagedestroy($src);
imagedestroy($tmp);
?>


#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 25 May 2006 - 09:26 AM

You're assigning your files temp name to a variable called $uploadedfile but calling the variable $uploadfile everywhere else.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users