/ Published in: PHP
URL: http://www.aristoworks.com
This is a simple script that will allow you to crop an image that you upload from a form.
Expand |
Embed | Plain Text
$file = $_FILES['image']['name']; $newwidth = 200; // SET YOUR DESIRED WIDTH $small_image = "small_".$small_image; $smallfile = $_FILES['image']['tmp_name']; $src = imagecreatefromjpeg($smallfile); $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $filename = $imagepath."small/".$small_image; imagejpeg($tmp,$filename,100); imagedestroy($src); imagedestroy($tmp);
You need to login to post a comment.
