I rewrote my code alittle and now its not working for me. I keep getting the error:
Warning: imagejpeg(): Unable to open 'sample.jpg' for writing in /usr/home/newporth/public_html/Beacon/New_Site/addentry.php on line 145
I have all the permissions on to write to the file. What is also strange is the writing in should be Beacon/New_Site/_images/right_thing , i'm not sure why its trying to go into the php file. 😕 😕
Here is my code:
//Full Size Image Upload
define("filedir", "home/newporth/public_html/Beacon/New_Site/_images/right_thing/");
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
$imagename = $_FILES['file']['name'];
// Make Temp image file
$uploadedfile = $_FILES['file']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
//Get size of image
list($width, $height)= getimagesize($uploadedfile);
// Set Resize
$newwidth = 100;
$newheight=($height/$width)*100;
$tmp=imagecreatetruecolor($newwidth,$newheight);
//resize image
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
imagejpeg($tmp ,$imagename ,100);
// Save Resized
$
// Move to Upload Directory
$movefile= move_uploaded_file($imagename, filedir);
imagedestroy($src);
imagedestroy($tmp);
}
Thanks for the help!