note 115355 added to function.imagecrop
| From: | nangomusic at gmail dot com | Date: | Thu, 10 Jul 2014 22:38:55 +0000 |
| Subject: | note 115355 added to function.imagecrop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199909@lists.php.net to get a copy of this message | ||
An example to crop an image stored in $filename:
<?php
// Create a blank image and add some text
$ini_filename = 'test.JPG';
$im = imagecreatefromjpeg($ini_filename );
$ini_x_size = getimagesize($ini_filename )[0];
$ini_y_size = getimagesize($ini_filename )[1];
//the minimum of xlength and ylength to crop.
$crop_measure = min($ini_x_size, $ini_y_size);
// Set the content type header - in this case image/jpeg
//header('Content-Type: image/jpeg');
$to_crop_array = array('x' =>0 , 'y' => 0, 'width' =>
$crop_measure, 'height'=> $crop_measure);
$thumb_im = imagecrop($im, $to_crop_array);
imagejpeg($thumb_im, 'thumb.jpeg', 100);
?>
----
Server IP: 72.52.91.14
Probable Submitter: 91.187.81.138
----
Manual Page -- http://php.net/manual/en/function.imagecrop.php
Edit -- https://master.php.net/note/edit/115355
Del: integrated -- https://master.php.net/note/delete/115355/integrated
Del: useless -- https://master.php.net/note/delete/115355/useless
Del: bad code -- https://master.php.net/note/delete/115355/bad+code
Del: spam -- https://master.php.net/note/delete/115355/spam
Del: non-english -- https://master.php.net/note/delete/115355/non-english
Del: in docs -- https://master.php.net/note/delete/115355/in+docs
Del: other reasons-- https://master.php.net/note/delete/115355
Reject -- https://master.php.net/note/reject/115355
Search -- https://master.php.net/manage/user-notes.php