Home  >  Article  >  Backend Development  >  Make PHP image processing simple. Image processing class based on gb library with example code download_PHP tutorial

Make PHP image processing simple. Image processing class based on gb library with example code download_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:29:51915browse

The design idea of ​​this class is borrowed from jQuery, and images are manipulated through concatenation methods, such as:

Copy code The code is as follows:

$image = new UsaImage(array('filepath'=>'image1.jpg'));
//The picture covers a picture, the second and third parameters are the x and y positions to be placed
$image->Overlap("image99.gif", 10, 10)
//Overlay the image with relative position, the last parameter is the scaling ratio, the default is 1
->Overlap2(' image00.gif',array('right'=>23,'bottom'=>50),0.5)
//Scale the image, set the maximum width and maximum height, the image will be scaled in equal proportions
- >Scale3(300,300)
//Output to the screen, the image header will be automatically added, the type is jpg, IMAGETYPE_JPEG is a constant of the gb library of php
->Write(IMAGETYPE_JPEG);

Effect:

For more methods, please check the code notes

Code download: usaimage.rar

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323332.htmlTechArticleThe design idea of ​​this class is borrowed from jQuery, and the image is manipulated through the concatenation method, such as: Copy the code as follows: $ image = new UsaImage(array('filepath'='image1.jpg')); //Image overlay...
Statement:
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