PHP image processing (2) GraphicsMagick installation extension and how to use it
How to install GraphicsMagick?
PHP Image Processing (1) Introduction and Installation of GraphicsMagick
GraphicsMagick PHP extension installation
Operating system: Centos 5.6
Operation steps
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
Operation steps
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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.