PHP Image Crop

This simple PHP image cropper does the job just fine. Just set height and width of picture ( or you can provide it over parameters ) and run the script.

Example: HERE


//crop.php by webarto.com
 
$filename=$_GET("file");
$w=206;$h=206;
$image = imagecreatefromjpeg($filename);
$crop = imagecreatetruecolor($w,$h);
$w0 = imagesx($image);$h0 = imagesy($image);
$x=floor($w0 / 2) - floor ($w / 2);
$y=floor($h0 / 2) - floor($h / 2);
imagecopy($crop, $image, 0, 0, $x, $y, $w, $h );
header('Content-type: image/jpg');
imagejpeg($crop);
imagedestroy($crop);

©2009-2011 Webarto • web design & development • Tuzla // Sarajevo // Beograd