Home > Backend Development > PHP Tutorial > PHP image processing module magickwand_PHP tutorial

PHP image processing module magickwand_PHP tutorial

WBOY
Release: 2016-07-13 17:39:32
Original
1001 people have browsed it

MagickWand is a PHP module used to access ImageMagick's image processing library. Here is a code snippet using MagicWand:

<ol class="dp-c"><li class="alt"><span><span><?php  </span></span></li><li><span>  </span><span class="vars">$magick_wand</span><span>=NewMagickWand();  </span></li><li class="alt"><span>  MagickReadImage(</span><span class="vars">$magick_wand</span><span>,</span><span class="string">rose.jpg</span><span>);  </span></li><li><span>  </span><span class="vars">$drawing_wand</span><span>=NewDrawingWand();  </span></li><li class="alt"><span>  DrawSetFont(</span><span class="vars">$drawing_wand</span><span>,</span><span class="string">"/usr/share/fonts/bitstream-vera/Vera.ttf"</span><span>);  </span></li><li><span>  DrawSetFontSize(</span><span class="vars">$drawing_wand</span><span>,20);  </span></li><li class="alt"><span>  DrawSetGravity(</span><span class="vars">$drawing_wand</span><span>,MW_CenterGravity);  </span></li><li><span>  </span><span class="vars">$pixel_wand</span><span>=NewPixelWand();  </span></li><li class="alt"><span>  PixelSetColor(</span><span class="vars">$pixel_wand</span><span>,</span><span class="string">"white"</span><span>);  </span></li><li><span>  DrawSetFillColor(</span><span class="vars">$drawing_wand</span><span>,</span><span class="vars">$pixel_wand</span><span>);  </span></li><li class="alt"><span>  </span><span class="keyword">if</span><span> (MagickAnnotateImage(</span><span class="vars">$magick_wand</span><span>,</span><span class="vars">$drawing_wand</span><span>,0,0,0,</span><span class="string">"Rose"</span><span>) != 0)  </span></li><li><span>    {  </span></li><li class="alt"><span>      MagickEchoImageBlob( </span><span class="vars">$magick_wand</span><span> );  </span></li><li><span>    }  </span></li><li class="alt"><span>  </span><span class="keyword">else</span><span> </span></li><li><span>    {  </span></li><li class="alt"><span>      </span><span class="func">echo</span><span> MagickGetExceptionString(</span><span class="vars">$magick_wand</span><span>);  </span></li><li><span>    }  </span></li><li class="alt"><span>?> </span></span></li></ol>
Copy after login

Installation method:

Download php_magickwand_q16_st.dll for 5.2.x

Place it in the PHP extension directory

Add extension=php_magickwand_q16_st.dll

to the php.ini file

Restart apache

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486302.htmlTechArticleMagickWand is a PHP module used to access the ImageMagick image processing library. Here is a code snippet using MagicWand: ?php $magick_wand =NewMagickWand(); MagickReadIm...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template