Jump to content

Recommended Posts

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);
?>
Link to comment
https://forums.phpfreaks.com/topic/10414-help-with-image-resizing/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.