Rumah  >  Artikel  >  pembangunan bahagian belakang  >  PHP图像处理模块 magickwand_PHP教程

PHP图像处理模块 magickwand_PHP教程

WBOY
WBOYasal
2016-07-13 17:39:32986semak imbas

  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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486302.htmlTechArticleMagickWand 是一个PHP的模块,用来访问 ImageMagick 的图像处理库。下面是一个使用 MagicWand 的代码片段: ?php $magick_wand =NewMagickWand(); MagickReadIm...
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn