Home PHP Libraries Other libraries Image processing library for PHP
PHP image processing library
<?php
use PHPImageWorkshop\ImageWorkshop as ImageWorkshop;
require_once(__DIR__.'/autoload.php');
class ImageWorkshopTest extends \PHPUnit_Framework_TestCase
{
===================================================================================
    
    const IMAGE_SAMPLE_PATH = '/Resources/images/sample1.jpg';
    const FONT_SAMPLE_PATH  = '/Resources/fonts/arial.ttf';
    const WEB_PATH          = 'http://localhost:8000';
    public function testInitFromPath()
    {
        // test 1
        
        $layer = ImageWorkshop::initFromPath(__DIR__.static::IMAGE_SAMPLE_PATH);
        
        $this->assertTrue(is_object($layer) === true, 'Expect $layer to be an object');
        $this->assertTrue(get_class($layer) === 'PHPImageWorkshop\Core\ImageWorkshopLayer', 'Expect $layer to be an ImageWorkshopLayer object');
        // test 2
        $layer = ImageWorkshop::initFromPath('file://'.__DIR__.static::IMAGE_SAMPLE_PATH);
        $this->assertTrue(is_object($layer) === true, 'Expect $layer to be an object');
        $this->assertTrue(get_class($layer) === 'PHPImageWorkshop\Core\ImageWorkshopLayer', 'Expect $layer to be an ImageWorkshopLayer object');
        // test 3
        if (version_compare(PHP_VERSION, '5.4', '>=')) {
            $layer = ImageWorkshop::initFromPath(static::WEB_PATH.'/sample1.jpg');
            $this->assertTrue(is_object($layer) === true, 'Expect $layer to be an object');
            $this->assertTrue(get_class($layer) === 'PHPImageWorkshop\Core\ImageWorkshopLayer', 'Expect $layer to be an ImageWorkshopLayer object');
        }

The advantages of this library.

The thumbnail speed is very fast and the quality is very high

Support smart cropping

Very good support for GIF images

5 thumbnail modes

Image comparison function

Advanced image filtering function

Image blending

The APIs supported by other image processing libraries are basically supported


Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

How Can I Modify Pixel Colors in a JPEG Image Using Go's Image Processing Library? How Can I Modify Pixel Colors in a JPEG Image Using Go's Image Processing Library?

29 Dec 2024

Pixel Color Modification in Go Image ProcessingChallenge:Manipulating a JPEG image by modifying the color of specific pixels necessitates...

Which PHP ORM Library is Best for Abstracting Database Vendors and Mapping Domain/Relational Models? Which PHP ORM Library is Best for Abstracting Database Vendors and Mapping Domain/Relational Models?

05 Jan 2025

PHP ORM Library RecommendationsWhen it comes to object-relational mapping (ORM) for PHP, there are several libraries that stand out. To address...

ssential Python Libraries for Advanced Computer Vision and Image Processing ssential Python Libraries for Advanced Computer Vision and Image Processing

01 Jan 2025

As a best-selling author, I invite you to explore my books on Amazon. Don't forget to follow me on Medium and show your support. Thank you! Your support means the world! Python has become a powerhouse for computer vision and image processing tasks

How Does jQuery Simplify DOM Manipulation for Web Developers? How Does jQuery Simplify DOM Manipulation for Web Developers?

03 Jan 2025

Overflow: Hidden and Expansion of HeightjQuery distinguishes itself from other JavaScript libraries through its cross-platform compatibility and...

When Should I Use References for Efficient Array Processing in PHP? When Should I Use References for Efficient Array Processing in PHP?

30 Dec 2024

Proper Reference Passing for Array ProcessingReference passing in PHP is a critical concept for optimizing code performance. In the context of...

How to Execute Command Line Binaries in Node.js? How to Execute Command Line Binaries in Node.js?

27 Dec 2024

Executing Command Line Binaries in Node.jsExecuting third-party binaries is an essential task when porting CLI libraries from other languages to...

See all articles