g3mma111 Posted August 19, 2007 Share Posted August 19, 2007 i got a image upload and resize script from the internet and want to change it so that when the image is resized it is not saved to the /images folder with its original file name but the value of $username and then the file name. Here is the code at the moment: <?php $uploadedfile = $_FILES['uploadfile']['tmp_name']; $src = imagecreatefromjpeg($uploadedfile); list($width,$height)=getimagesize($uploadedfile); $newwidth=100; $newheight=($height/$width)*100; $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $filename = "profilepicthumb/". $_FILES['uploadfile']['name']; imagejpeg($tmp,$filename,100); imagedestroy($src); imagedestroy($tmp); ?> im guessing the code goes in here somewhere but i dont really have a clue what i am doing! any help would be appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/65667-solved-new-to-php-please-help-with-image-upload/ Share on other sites More sharing options...
g3mma111 Posted August 19, 2007 Author Share Posted August 19, 2007 sorry - the profilepicthumb/ is meant to be images/ Quote Link to comment https://forums.phpfreaks.com/topic/65667-solved-new-to-php-please-help-with-image-upload/#findComment-327948 Share on other sites More sharing options...
MadTechie Posted August 19, 2007 Share Posted August 19, 2007 just change $filename = "profilepicthumb/". $_FILES['uploadfile']['name']; to the new path & name from what i can see thats what is it doing! ie $filename = "profilepicthumb/sam.jpg"; Quote Link to comment https://forums.phpfreaks.com/topic/65667-solved-new-to-php-please-help-with-image-upload/#findComment-327965 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.