Sniptools » Tutorials

Using ImageMagick with PHP

May 27, 2003 Views (42,924) /  Comments (4) /  Trackback (0) / Digg/Share


There is a PHP module for Imagemagick, called imagick, sort of like the one for GD. Following is some simple code that has worked for me.

<?

if(!extension_loaded(‘imagick’)) { dl(‘imagick.so’); }
$handle = imagick_create();
imagick_set_attribute($handle,array(“quality”=>1,”magick”=>”png”));
imagick_set_attribute($handle,”size”,”98x20”);
imagick_read($handle,”xc:#cccccc”);
imagick_annotate($handle,array(
“primitive” => “text 10,14 hello”,
“pointsize” => 16,
“antialias” => 1,
“stroke” => “#000000”,
“font” => “arial.ttf”,
));
$handle = imagick_copy_rotate ($handle, 270);
header(“Content-type: image/png”);
imagick_dump($handle,”png”);

?>

(91 Words | )

 
Possibly Related
Other stuff that may be of interest  
Comments
What readers have asked/said/added.

^1 superD said on August 28, 2004 11:49 AM:

would it be possible that you may make it a bit more specific for the non-programmers??
such as “save as” and the next next step…etc??
if it’s possible would be great, love to use it on my site. Thanks!

^2 Vince said on October 3, 2004 2:00 AM:

There are more in-depth examples about how to use the IMAGICK PHP extension here:

http://pecl.php.net/get/imagick-0.9.11.tgz
http://pecl.php.net/package/imagick

The Samples/ directory contains about 30 examples on how you can use IMAGICK

-Vince
Biosonik.com

^3 Ben said on January 31, 2005 7:51 PM:

I think you are right. One neat thing, I'd have never predicted with the internet, is that the sites are staying around, so that people can find them, read them and learn from them. The worst thing about the .edu internet was data rot (a form of link rot) where resources and knowledge went into the vapor every semester.

^4 blub said on February 1, 2006 11:00 AM:

But what good are websites and references, if the software in question is not being actively developed. The imagick modul for example has so many bugs and glitches, and it seems that no one is taking care of it. So I wish someone would update all those websites, instead of them still being there, pointing to the same old (outdated) information.

 

Post a comment
Please be decent while posting comments, don't make us delete them, thanks.




Will be spam-protected.

Remember?


Comment Preview

XX said on :

 

Trackbacks
Ping @ http://sniptools.com/ping/2003-05/9. Listed below are links to weblogs that reference this article.

 

Referrals
*Some* places that viewers have come to this page from: