Jump to content

[SOLVED] New To PHP - please help with image upload!


g3mma111

Recommended Posts

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.