note 91478 added to function.imagick-cropthumbnailimage
| From: | benford at bluhelix dot com | Date: | Thu, 11 Jun 2009 21:14:13 +0000 |
| Subject: | note 91478 added to function.imagick-cropthumbnailimage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156786@lists.php.net to get a copy of this message | ||
I found a relevant posting complete with demo code at this site:
http://valokuva.org/?p=8
Sample code goes like this:
<?php
/* Read the image */
$im = new imagick( "test.png" );
/* create the thumbnail */
$im->cropThumbnailImage( 80, 80 );
/* Write to a file */
$im->writeImage( "th_80x80_test.png" );
?>
This is a specialization of the cropImage method. At a high level, this method will create a
thumbnail of a given image, with the thumbnail sized at ($width, $height).
If the thumbnail does not match the aspect ratio of the source image, this is the method to use. The
thumbnail will capture the entire image on the shorter edge of the source image (ie, vertical size
on a landscape image). Then the thumbnail will be scaled down to meet your target height, while
preserving the aspect ratio. Extra horizontal space that does not fit within the target $width will
be cropped off evenly left and right.
As a result, the thumbnail is usually a good representation of the source image.
----
Server IP: 208.69.120.35
Probable Submitter: 64.59.229.158
----
Manual Page -- http://www.php.net/manual/en/function.imagick-cropthumbnailimage.php
Edit -- https://master.php.net/note/edit/91478
Del: integrated -- https://master.php.net/note/delete/91478/integrated
Del: useless -- https://master.php.net/note/delete/91478/useless
Del: bad code -- https://master.php.net/note/delete/91478/bad+code
Del: spam -- https://master.php.net/note/delete/91478/spam
Del: non-english -- https://master.php.net/note/delete/91478/non-english
Del: in docs -- https://master.php.net/note/delete/91478/in+docs
Del: other reasons-- https://master.php.net/note/delete/91478
Reject -- https://master.php.net/note/reject/91478
Search -- https://master.php.net/manage/user-notes.php