note 78717 added to ref.imagick
| From: | mlong-php at mlong dot us | Date: | Wed, 24 Oct 2007 18:46:19 +0000 |
| Subject: | note 78717 added to ref.imagick | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131697@lists.php.net to get a copy of this message | ||
Here is an example on how to take an image that is already in a string (say, from a database), and
resize it, add a border, and print it out. I use this for showing reseller logos
// Decode image from base64
$image=base64_decode($imagedata);
// Create Imagick object
$im = new Imagick();
// Convert image into Imagick
$im->readimageblob($image);
// Create thumbnail max of 200x82
$im->thumbnailImage(200,82,true);
// Add a subtle border
$color=new ImagickPixel();
$color->setColor("rgb(220,220,220)");
$im->borderImage($color,1,1);
// Output the image
$output = $im->getimageblob();
$outputtype = $im->getFormat();
header("Content-type: $outputtype");
echo $output;
----
Server IP: 69.147.83.197
Probable Submitter: 70.43.247.18
----
Manual Page -- http://www.php.net/manual/en/ref.imagick.php
Edit -- https://master.php.net/note/edit/78717
Del: integrated -- https://master.php.net/note/delete/78717/integrated
Del: useless -- https://master.php.net/note/delete/78717/useless
Del: bad code -- https://master.php.net/note/delete/78717/bad+code
Del: spam -- https://master.php.net/note/delete/78717/spam
Del: non-english -- https://master.php.net/note/delete/78717/non-english
Del: in docs -- https://master.php.net/note/delete/78717/in+docs
Del: other reasons-- https://master.php.net/note/delete/78717
Reject -- https://master.php.net/note/reject/78717
Search -- https://master.php.net/manage/user-notes.php