<?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
30 Oct 2024
Native Java Image Processing Libraries for High-Quality ResultsAs you have encountered limitations with ImageMagick and JAI, let's explore other...
10 May 2023
With the rapid development of the Internet, image processing has become more and more important. There are various ways to process images. This article will focus on how to use PHP for image processing. PHP is a server-side scripting language originally designed for web development that can easily handle images. In PHP, there are many classes and functions that can be used to process images, such as GD, ImageMagick and other libraries. In this article, we will discuss how to use the GD library for image processing. 1. Installation of GD library GD library is a part of PHP
17 Jul 2023
Summary of image blurring methods using PHP and OpenCV libraries: Image blurring is commonly used in image enhancement, privacy protection and other application fields. This article describes how to implement image blurring using PHP and the OpenCV library, with code examples. Introduction Image blur processing is a technology widely used in image processing and can be used in image enhancement, privacy protection, image style conversion and other fields. In this article, we will introduce how to implement image blurring using PHP language and OpenCV library. Open
13 May 2023
With the development of the Internet, image processing has gradually become a very important field. In this field, PHP is a very commonly used programming language. Because the PHP programming language is very popular, and PHP has many extension libraries specifically for image processing, such as GD, ImageMagick, etc. These extension libraries have powerful functions and can complete image processing tasks quickly and easily. Therefore, this article will introduce how to use PHP for image processing. 1. Understand the GD library. The GD library is commonly used in PHP image processing.
02 Jun 2023
The PHP image processing class library is one of the commonly used tools for PHP developers. It can help us edit, crop, zoom and other operations on images quickly and easily. This article will introduce how to use the PHP image processing class library. 1. What is the PHP image processing library? The PHP image processing class library is a set of toolkits developed to facilitate PHP developers to quickly process images. It can handle image formats such as JPG, PNG, GIF and BMP, and realize image scaling, rotation, cropping, etc.
03 Nov 2023
How to use middleware for image processing in Laravel Image processing is a very common task in modern web applications. Laravel is a very popular PHP framework that provides a powerful image processing function. By using middleware, we can process images more efficiently without relying on other third-party libraries. Below, we will use a practical example to illustrate how to use middleware for image processing in Laravel. First, we need to create a
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