resize image and upload it to ftp (problem)
Posted: Thu Jul 20, 2006 8:37 am
hi!
i'm using this code to resize an image posted in a form:
php:
Before i was using this code to upload to my ftp images posted in a form:
Everything was working separately ok. But what i'm not achieving is to weld both codes to, in one step, resize and post images to my ftp.
Any ideas?
thanx
Martin
i'm using this code to resize an image posted in a form:
php:
Code: Select all
<?
$uploadedfile = $_FILES['images']['tmp_name'][$key];
$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);
$newwidth=600;
$newheight=($height/$width)*600;
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = "tmp/". $_FILES['images']['tmp_name'][$key];
imagejpeg($tmp,$filename,100);
imagedestroy($src);
imagedestroy($tmp);
?>Code: Select all
$add = $newdir.$filename;
ftp_put($id_con, $add, $_FILES['images']['tmp_name'][$key], FTP_BINARY);Any ideas?
thanx
Martin