image resizer

image resizer

am 02.10.2007 18:14:40 von Jim

I am trying to upload/resize an image to 400 by 300px and then copy it to a
folder. This is what I have so far. Can anyone help?

Thanks,

R.

if(isset($_POST['_upload']) && $_FILES['userfile']['size'] > 0)
{

$imageinfo = getimagesize($_FILES['userfile']['tmp_name']);

echo $width=$imageinfo[0];
echo $height=$imageinfo[1];


// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($_FILES['userfile']['tmp_name']);

// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, 400, 300, $width, $height);

// Output

$target_path = "../property_images/$property_id/".basename(
$_FILES['userfile']['name']);

if (imagejpeg($thumb, $target_path))
{
echo 'sucess!';
}
else
{
echo "no luck";
}




Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com