10 best PHP image operation libraries in 2014, 2014php

Source: Internet
Author: User
Tags image processing library watermark images

10 best PHP image operation libraries in 2014, 2014php

Thomas Boutell and many developers have created a graph software library famous for the GD graphics library for Dynamic Graph computing. GD provides support for many programming languages, such as C, Perl, Python, PHP, and OCaml. in addition to generating HTML output, you can also use php to create and compute graphics files in a large number of graphic file formats such as PNG, JPEG, GIF, WBMP, and XPM. in addition, php allows you to directly output image streams to a browser. to achieve this, you need to compile php by using the GD library image function.

In this article, you will learn 10 optimal php graphics computing libraries, which can help you simplify your work. these graphic computing libraries will help you in your graphic-related work. some of the best php graphics computing libraries used by developers are described below:

1. Imagine

This image processing library is an object-oriented PHP library built with PHP 5.3. By using this library, you can easily crop, resize, and place filters on images. To generate the specified RGB code value and object transparency percentage, the color class of this library has two parameters in its constructor.

2. Php Graphic Works

This library is created for image processing on the server. Using this image library allows you to perform complex image processing in a simple way. Operations on images, including rotation, cropping, scaling, stretching, and flip. You only need a bunch of code to complete this.

3. Zebra Image

This lightweight and Object-Oriented Image Processing library is built using PHP. The supported image formats include JPG, GIF, and PNG. It has a unique capability, that is, after each action, you can convert one format to another.

4. Php5 Image Manipulation

This fully Object-Oriented Image Processing library can be used for PHP and gd2. It is considered an extension form of the PHP-image project. This Object-Oriented Image Processing Library provides various ICO image file types, such as PNG, GIF, PSD, JPEG, and ICO. In addition, it can output various image file types supported by gd2.

5. Dynamic Virtual Image Generation

This is a free PHP script library that allows you to generate images of any size and color. In addition, you can input text on the image.

6. WideImage

Wide Image is also considered an object-oriented library for Image processing. With this library, you can perform general operations such as processing, loading, and saving images in image format.

7. Image Cache

This lightweight PHP class is used to move, compress, and cache images in browsers. Then, it returns the new source of the image that is printed in the image Tag. You can use this library by setting various options, such as base URL and directory.

8. Image Workshop

This is a freely usable PHP class that is considered to be layer-based image editing software. It allows you to Stack multiple layers and has the ability to execute functions such as placing an image on the other to move, and resize, crop, write, rotate, and stack.

9. Asido

This is a PHP library with rich features for operating images and is suitable for any operating environment, such as Magick Wand, GD2, and Image Magick. It supports both PHP4 and PHP5.

10. PhpThumb

In addition to various popular image formats, the PHP Library also accepts all image resource types. Using this image operation library, you can rotate, crop, and watermark images. In addition, you can define the pixels of an image.


How to output images in the php gb Image Library

Call example: Output two Chinese characters "China" Through GD
Example. php

// Header ("Content-type: image/gif ");
$ Im = imagecreate (400,300 );
$ Bkg = ImageColorAllocate ($ im, 0, 0 );
$ Clr = ImageColorAllocate ($ im, 255,255,255 );
$ Fnt = "d:/winnt/fonts/simhei. ttf ";
Include ("gb2utf8. php ");
$ Str = gb2utf8 ("China ");
ImageTTFText ($ im, 20, 0, 10, 20, $ clr, $ fnt, $ str );
ImageGif ($ im );
ImageDestroy ($ im );

Php + mysql image insertion and display operation code

If you store image streams, the database will be very large. We recommend that you store the images in a uniform directory for convenient management.
The insert field can be stored in the relative path of vchar.
Reading is to query the database and put it in the array,
Show .

Function uploadPhoto ($ file ){

$ This-> result = false;
$ This-> error = false;
// -- Save parameters
$ This-> _ file = $ file;
// Get path
$ This-> createUploadDir ();
$ This-> _ destination = SystemProperties: $ UPLOAD_ROOT_PATH ['photo '];
// If (! Is_null ($ allowed) {$ this-> _ allowed = $ allowed;} else {$ this-> _ allowed = array ('jpg ', 'jpeg ', 'gif', 'png ');}

// -- Check that FILE array is even set
If (isset ($ file) & is_array ($ file )&&! $ This-> upload_error ($ file ['error']) {

// -- Cool, now set some variables
$ FileID = $ this-> _ IDGenerator-> getNextId ('image ');
$ FileExt = $ this-> ext ($ file ['name']);
$ FileName = $ fileID. '.'. $ fileExt;
$ This-> createFileDir ('image', $ fileName );
$ FileTmp = $ file ['tmp _ name'];
// $ FileSize = $ file ['SIZE'];
// $ FileType = $ file ['type'];
$ FileError = $ file ['error'];

// -- Update name
$ This-> _ name = $ this-> _ destination. $ fileName;
// -- It's been uploaded with php
If (is_uploaded_file ($ fileTmp )){
// -- Where to put the file?
$ FilePath = $ this-> _ fileUtil-> getFilePath ($ fileName );
$ Output = $ this-> _ destination. $ filePath ['filepath'];
... The remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.