search
HomePHP LibrariesOther librariesImage 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

Which native Java image processing library is right for you?Which native Java image processing library is right for you?

30Oct2024

Native Java Image Processing Libraries for High-Quality ResultsAs you have encountered limitations with ImageMagick and JAI, let's explore other...

Looking for  High-Quality Java Image Processing: Is ImgScalr the Answer?Looking for High-Quality Java Image Processing: Is ImgScalr the Answer?

28Oct2024

Optimizing Java Image Processing: Comparing Libraries and ApproachesDespite utilizing both JAI media APIs and ImageMagick, a developer encounters...

What is the Best Java Image Processing Library for High-Quality Results?What is the Best Java Image Processing Library for High-Quality Results?

31Oct2024

Java Image Processing Library OptionsIn exploring Java image processing, you may have encountered limitations with both JAI media APIs and...

PHP image processing, php image processing_PHP tutorialPHP image processing, php image processing_PHP tutorial

12Jul2016

PHP image processing, php image processing. PHP image processing, php image processing PHP provides some functions for editing and processing images. The most typical applications are random graphic verification codes, image watermarks and data statistics.

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?

29Dec2024

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?

05Jan2025

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

See all articles