svycka / sv-images
使用PHP编写的图像处理库,类似于Imgix和Cloudinary等云图像处理服务。此模块简化了Zend Framework 2中的图像处理
0.1.0
2016-04-07 06:50 UTC
Requires
- php: >=5.5
- intervention/image: ~2.3
- zendframework/zend-http: ~2.5
- zendframework/zend-modulemanager: ~2.5
- zendframework/zend-mvc: ~2.5
- zendframework/zend-servicemanager: ^2.7.5
- zendframework/zend-stdlib: ~2.5
Requires (Dev)
- ext-gd: *
- league/flysystem: ^1.0
- phpunit/phpunit: 4.*
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ^2.0
Suggests
- league/flysystem: To use this library to load image
This package is auto-updated.
Last update: 2024-09-10 19:42:14 UTC
README
使用PHP编写的图像处理库,类似于Imgix和Cloudinary等云图像处理服务。此模块简化了Zend Framework 2中的图像处理
安装
通过Composer
$ composer require svycka/sv-images
基本用法
- 在config/application.config.php中注册SvImages模块
- 创建文件系统工厂,例如
class ImageFilesystemFactory implements FactoryInterface { public function createService(ServiceLocatorInterface $serviceLocator) { $flysystem = new \League\Flysystem\Filesystem(new Local(__DIR__.'/path/to/files')); $adapter = new \SvImages\Filesystem\Adapter\FlySystemAdapter($flysystem); return new \SvImages\Filesystem\Filesystem($adapter); } }
- 创建缓存存储,为了最佳性能,应指向公共目录,这样一旦生成缓存,PHP就不会被再次调用,例如
class ImageCacheStorageFactory implements FactoryInterface { public function createService(ServiceLocatorInterface $serviceLocator) { $flysystem = new \League\Flysystem\Filesystem(new Local(__DIR__.'/path/to/public')); return new \SvImages\Cache\FlySystemStorage($flysystem); } }
- 将位于vendor/svycka/sv-images/config/images.global.php.dist的文件复制到config/autoload/images.global.php,并根据需要更改值
- 通过访问http://example.com/image/crop,x15,y15,w300,h300/fit,w200,h150,top-left/f_key/your-image.jpg来测试它
变更日志
有关最近更改的更多信息,请参阅CHANGELOG。
鸣谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。