An example analysis of magickwand usage of PHP image processing class Library
This article describes the PHP image processing class library Magickwand usage. Share to everyone for your reference. The specific analysis is as follows:
Magickwand is an extension of PHP, through which the interaction with the ImageMagick is established and the image is processed. It is an excellent alternative to the default GD image library. In terms of security and ease of use, using Magickwand in PHP is much safer and quicker than using command-line ImageMagick. In addition, Imagick can also be used as an alternative to ImageMagick in PHP.
There are two forms of Magickwand,
Just establish an interaction with ImageMagick, this situation must first install ImageMagick, the advantage is that the extension file small (generally hundreds of k), you can quickly upgrade the ImageMagick version, but the Windows temporary directory requires special permissions.
The Extender itself contains ImageMagick, with the advantage that no additional installation ImageMagick is required, the temporary directory does not require special permissions, but the Extender file is larger (typically 4M or more).
Magickwand default is not in the PHP installation package, need to go to PHP website download, and open this extension in php.ini.
Here is a code snippet that uses Magicwand:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$magick _wand=newmagickwand (); Magickreadimage ($magick _wand, ' rose.jpg '); $drawing _wand=newdrawingwand (); Drawsetfont ($drawing _wand, "/usr/share/fonts/bitstream-vera/vera.ttf"); Drawsetfontsize ($drawing _wand,20); Drawsetgravity ($drawing _wand,mw_centergravity); $pixel _wand=newpixelwand (); Pixelsetcolor ($pixel _wand, "white"); Drawsetfillcolor ($drawing _wand, $pixel _wand); if (Magickannotateimage ($magick _wand, $drawing _wand,0,0,0, "Rose")! = 0) { Magickechoimageblob ($magick _wand); } Else { Echo magickgetexceptionstring ($magick _wand); } |
Installation method:
1. Download Php_magickwand_q16_st.dll for 5.2.x
2. Place it in the PHP extensions directory
3. Total increase in php.ini files Extension=php_magickwand_q16_st.dll
4. Restart Apache
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1003824.html www.bkjia.com true http://www.bkjia.com/PHPjc/1003824.html techarticle PHP Image processing class Library Magickwand Usage Example This article describes the PHP image processing class library Magickwand usage. Share to everyone for your reference. The specific analysis is as follows: Magickwand is ...