定制 tigroid3/php-imaginary 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tigroid3/php-imaginary

最新稳定版本:1.03

Composer 安装命令:

composer require tigroid3/php-imaginary

包简介

SDK for https://github.com/h2non/imaginary

README 文档

README

SDK for https://github.com/h2non/imaginary

Either run

$ composer require tigroid3/php-imaginary

or add

"tigroid3/php-imaginary": "*"

to the require section of your composer.json file.

Basic usage:

Set service uri

$client = new ImaginaryClient();
$client->setServiceUri('http://imaginary:9005');

Image processing

$imaginaryResource = Imaginary::new()
    ->setUploadFilePath('/home/user/test.jpg')
    ->smartCrop(300, 300)
    ->zoom(2)
    ->convert(Imaginary::FORMAT_WEBP)
    ->execute();
        
//save new image        
file_put_contents('test.webp', $imaginaryResource->getContent());
//or 
move_uploaded_file($imaginaryResource->getPathProcessedFile(), 'test.webp');

Image info

$imageInfo = Imaginary::new()
    ->setUploadFilePath('/home/user/tmp/test.jpg')
    ->info();

Example response

Array
(
    [width] => 3840
    [height] => 2400
    [type] => jpeg
    [space] => srgb
    [hasAlpha] =>
    [hasProfile] =>
    [channels] => 3
    [orientation] => 0
)

统计信息

  • 总下载量: 4.95k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2020-06-30