GraphicsMagick PHP extension installation
1: Install PHP extension gmagick-1.0.9
<span style="line-height: 1.5; font-size: 12px; color: #008000;"># </span><span style="line-height: 1.5; font-size: 12px; color: #008000;">安装扩展</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"><br></span>tar -zxvf gmagick-1.0.9b1.tgz<br>cd gmagick-1.0.9b1<br>/usr/local/php/bin/phpize<br>./configure --with-php-config=/usr/local/php/bin/php-config<br>make <br>make install
2: Modify the PHP.ini file
<span style="line-height: 1.5; font-size: 12px; color: #008000;">#</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"> 修改配置文件</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"><br></span>vi /usr/local/php/etc/php.ini<br><span style="line-height: 1.5; font-size: 12px; color: #008000;">#</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"> extension_dir = './' 更改路径</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"><br></span>extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/gmagick.so"<br><span style="line-height: 1.5; font-size: 12px; color: #008000;">#</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"> 开启gmagick扩展</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"><br></span>extension = gmagick.so<br><span style="line-height: 1.5; font-size: 12px; color: #008000;">#</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"> 重启Apache</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"><br></span>/usr/local/apache2/bin/apachectl restart
3: Display the configuration information of the php server and check whether the extension is installed
<span style="line-height: 1.5; font-size: 12px; color: #008000;">#</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"> 创建文件</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"><br></span>vi /usr/local/apache2/htdocs/index.php<br><span style="line-height: 1.5; font-size: 12px; color: #008000;">#</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"> 写入</span><span style="line-height: 1.5; font-size: 12px; color: #008000;"><br></span><?php <br> <span style="line-height: 1.5; font-size: 12px; color: #008080;">phpinfo</span>();<br>?>
How to use GraphicsMagick PHP extension
1: Prepare a picture, does it look like Sun Honglei
<?php <br><span style="color: #008000;">#</span><span style="color: #008000;"> 如果使用扩展报错请安装libpng ,libjpeg ,libmcrypt到默认目录</span><span style="color: #008000;"><br></span><br><span style="color: #800080;">$image</span> = <span style="color: #0000ff;">new</span> Gmagick('1.jpg');<br><br><span style="color: #800080;">$image</span>->borderImage('blue',3,3)->oilPaintImage(0.1);<br><br><span style="color: #800080;">$image</span>->write('2.jpg');<br>?>
<?php <br><span style="color: #800080;">$image</span> = <span style="color: #0000ff;">new</span> Gmagick('1.jpg');<br><br><span style="color: #008000;">//</span><span style="color: #008000;"> 改变图片大小</span><span style="color: #008000;"><br></span><span style="color: #800080;">$image</span>->resizeimage(100,200);<br><br><span style="color: #800080;">$image</span>->write('2.jpg');<br>?>
For more methods, please see the relevant documents above