utopia-php / image
一个简单的图像处理库
0.6.1
2024-02-05 13:31 UTC
Requires
- php: >=8.0
- ext-imagick: *
Requires (Dev)
- laravel/pint: 1.2.*
- phpstan/phpstan: 1.9.x-dev
- phpunit/phpunit: ^9.3
- vimeo/psalm: 4.13.1
This package is auto-updated.
Last update: 2024-08-29 13:30:01 UTC
README
Utopia Image库是一个轻量级且快速的微型PHP库,用于创建常见的图像处理,使用起来非常简单。这个库由Appwrite团队维护。
入门指南
使用composer安装
composer require utopia-php/image
<?php require_once '../vendor/autoload.php'; use Utopia\Image\Image; //crop image $image = new Image(\file_get_contents('image.jpg')); $target = 'image_100x100.jpg'; $image->crop(100, 100, Image::GRAVITY_NORTHWEST); $image->save($target, 'jpg', 100); $image = new Image(\file_get_contents('image.jpg')); $target = 'image_border.jpg'; $image->setBorder(2, "#ff0000"); //add border 2 px, red $image->setRotation(45); //rotate 45 degree $image->save($target, 'jpg', 100); $image = new Image(\file_get_contents('image.jpg')); $target = 'image_border.jpg'; $image->setOpacity(0.2); //set opacity $image->save($target, 'png', 100);
系统要求
Utopia Image需要PHP 8.0或更高版本。我们建议尽可能使用最新的PHP版本。
版权和许可证
MIT许可证 (MIT) http://www.opensource.org/licenses/mit-license.php