bencagri / photon
该软件包最新版本(1.0.2)没有提供许可证信息。
1.0.2
2018-02-09 13:20 UTC
Requires (Dev)
- symfony/var-dumper: ^4.1@dev
This package is auto-updated.
Last update: 2024-09-28 23:28:17 UTC
README
JETPACK PHOTON 包装器
什么是Photon?
Photon是Jetpack连接的WordPress网站的一个图像加速和修改服务。转换后的图像会自动缓存并从WordPress.com CDN提供服务。可以使用简单的API(通过GET查询参数控制)来裁剪、调整大小和过滤图像。当在Jetpack中启用Photon时,图像会实时更新。
为什么需要包装器?
这个包装器允许你在自己的主机(服务器)上使用Photon,并且它是完全面向对象的。
安装
$ composer require bencagri/photon
注意:要在你的服务器上使用它,你需要安装 gmagick 包。
示例实现。
<?php use Photon\Wrapper\Generate; use Photon\Wrapper\Effect\Height; use Photon\Wrapper\Effect\Width; use Photon\Wrapper\Effects; require 'vendor/autoload.php'; // Set your effects $effects = new Effects( new Width(500), new Height(500) ); $imageUrl = 'http://sample-site.com/sample-image.jpg'; //Generate image with your effects $process = new Generate($imageUrl,$effects); $process->process();
你还可以组合多种效果。
<?php use Photon\Wrapper\Effect\Crop; use Photon\Wrapper\Effect\Filter; use Photon\Wrapper\Effects; $crop = new Crop(500,250,330,300); $effects = new Effects( $crop, new Filter('emboss') );
所有效果的完整 文档。
许可证
- Photon Wrapper 是开源软件,根据MIT许可证授权。
- Photon 是开源软件,根据GNU通用公共许可证授权。