首頁 > php教程 > php手册 > PHP图像处理模块 magickwand

PHP图像处理模块 magickwand

WBOY
發布: 2016-06-13 10:38:22
原創
812 人瀏覽過

  MagickWand 是一个PHP的模块,用来访问 ImageMagick 的图像处理库。下面是一个使用 MagicWand 的代码片段:

 

<ol class="dp-c">
<li class="alt"><span><span><?php  </span></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></li>
</ol>
登入後複製

安装方法:

  下载 php_magickwand_q16_st.dll for 5.2.x

  将其放在PHP的扩展目录

  在php.ini文件总增加 extension=php_magickwand_q16_st.dll

  重新启动apache

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板