<?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
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
29 Dec 2024
Pixel Color Modification in Go Image ProcessingChallenge:Manipulating a JPEG image by modifying the color of specific pixels necessitates...
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...
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
03 Jan 2025
Overflow: Hidden and Expansion of HeightjQuery distinguishes itself from other JavaScript libraries through its cross-platform compatibility and...
30 Dec 2024
Proper Reference Passing for Array ProcessingReference passing in PHP is a critical concept for optimizing code performance. In the context of...
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...
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images