You are here: image resizer « All PHP « IT news, forums, messages
image resizer

Posted by JIM on 10/02/07 16:14

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация