文件名称:PHP的图像处理库.zip
文件大小:2.75MB
文件格式:ZIP
更新时间:2022-07-31 04:28:51
类库下载-PHP的图像处理库
<?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'); }本库的优势。缩略图的速度非常快,质量非常高支持智能剪裁很好的支持GIF图片5种缩略图模式图像对比功能图像高级过滤功能图像混合其他图像处理库支持的API基本都支持