<?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: [email protected]
How to use the Imagick library for advanced image processing in PHP
09 Nov 2025
The Imagick extension provides advanced image processing functions for PHP, supporting image scaling, cropping, format conversion, filter application and watermark addition after installation; it can handle GIF and PDF multi-frame images, and attention must be paid to resource release and exception handling.
PHP image processing class library and demonstration sharing, php image processing class library_PHP tutorial
12 Jul 2016
PHP image processing class library and demonstration sharing, PHP image processing class library. PHP image processing class library and demonstration sharing, PHP image processing class library I simply wrote a PHP image processing class library. Although it has relatively few functions, it is not too advanced at present and will be used in the future.
How to resize and crop images using PHP GD library? (Image processing)
23 Feb 2026
Resize_image() deforms because the aspect ratio is not maintained, so getimagesize() needs to be used to calculate the target size; crop_image() defaults to cropping from the upper left corner, and manual coordinate calculation is required for centering; JPEG saving must set the quality parameter to prevent quality degradation; large image processing requires timely imagedestroy() and limit the size.
How to use the Intervention Image library for image manipulation in PHP
01 Dec 2025
InterventionImage is a PHP library designed to simplify image processing tasks. After installation, configure the driver and load images. It supports resizing, cropping, adding watermarks, applying filters, saving or outputting images. It is suitable for GD and Imagick and is often used for image upload processing in Web projects.
How to use the Intervention Image library for easy image manipulation in PHP
16 Nov 2025
InterventionImageisaPHPlibraryforeasyimagemanipulation.ItsupportsGDandImagickdrivers,offersresizing,cropping,filters,watermarks,andworkswithlocal,uploaded,orremoteimagesviasimpleload-modify-saveoperations.
How to enable Pico.css on demand in a project without polluting styles globally
09 Feb 2026
Pico.css has provided the pico.conditional.min.css version since v2, which only takes effect on elements with class="pico" added, completely solving the problem of style conflicts with other UI libraries.
Popular tool
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
PHP library for dependency injection containers
PHP library for dependency injection containers
Small PHP library for optimizing images
Small PHP library for optimizing images




