note 95547 added to imagick.examples-1
| From: | sabo_ at mail dot ru | Date: | Fri, 08 Jan 2010 11:11:51 +0000 |
| Subject: | note 95547 added to imagick.examples-1 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164778@lists.php.net to get a copy of this message | ||
function ResizeImage($inputFile, $outputFile, $width = 100, $height = 100, $background =
'#ffffff')
{
$image = new Imagick($inputFile);
$image->adaptiveResizeImage($width, $height, true);
$image->setImageFormat('png');
$image->setImageBackgroundColor($background);
$iHeight = $height - $image->getImageHeight();
if($iHeight%2 && $height > 0)
$top = 0 - ($iHeight - 1) / 2;
else
$top = 0 - $iHeight / 2;
$iWidth = $width - $image->getImageWidth();
if($iWidth%2 && $width > 0)
$left = 0 - ($iWidth - 1) / 2;
else
$left = 0 - $iWidth / 2;
$image->extentImage($width, $height, $left, $top);
$image->writeImage($outputFile);
$image->clear();
$image->destroy();
}
----
Server IP: 195.54.192.44
Probable Submitter: 78.37.209.4
----
Manual Page -- http://www.php.net/manual/en/imagick.examples-1.php
Edit -- https://master.php.net/note/edit/95547
Del: integrated -- https://master.php.net/note/delete/95547/integrated
Del: useless -- https://master.php.net/note/delete/95547/useless
Del: bad code -- https://master.php.net/note/delete/95547/bad+code
Del: spam -- https://master.php.net/note/delete/95547/spam
Del: non-english -- https://master.php.net/note/delete/95547/non-english
Del: in docs -- https://master.php.net/note/delete/95547/in+docs
Del: other reasons-- https://master.php.net/note/delete/95547
Reject -- https://master.php.net/note/reject/95547
Search -- https://master.php.net/manage/user-notes.php