hi, i need to upload an image to two different directories.
first i would upload to the main directory of a bigger size photo.
next i would upload to the thumbnail folder with a thumbnail size photo.
this is my code, but the second upload is not working:
$preupload=$_FILES['uploadedfile']['tmp_name'];
$finalupload=cropimage($preupload,150);
if(!$finalupload)
echo "final upload not successful";
else
move_uploaded_file($finalupload, $GLOBALS['upload'].$imgid);
$thumbnail=cropimage($preupload,80);
if(!$thumbnail)
echo "final upload not successful";
else
move_uploaded_file($thumbnail, $GLOBALS['upload_thumbnail'].$imgid);
function cropimage($upload,$ratio=0)
{
$src = imagecreatefromjpeg($upload);
list($width,$height)=getimagesize($upload);
list($newwidth,$newheight)=resizeratio($ratio,$width,$height);
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$finalupload = $upload;//$_FILES['uploadedfile']['tmp_name'];
imagejpeg($tmp,$finalupload,100);
imagedestroy($src);
imagedestroy($tmp);
return $finalupload;
}