svycka / sv-images
Image manipulation library written in PHP, similar to cloud image processing services like Imgix and Cloudinary. This module simplifies image manipulation for 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-10-10 19:48:24 UTC
README
Image manipulation library written in PHP, similar to cloud image processing services like Imgix and Cloudinary. This module simplifies image manipulation for Zend Framework 2
Install
Via Composer
$ composer require svycka/sv-images
Basic Usage
- Register
SvImages
as module inconfig/application.config.php
- Create filesystem factory, exmaple:
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); } }
- Create cache storage, for best performance should point to public directory, so once cache is generated PHP will not be hit at all, example:
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); } }
- Copy the file located in
vendor/svycka/sv-images/config/images.global.php.dist
toconfig/autoload/images.global.php
and change the values as you wish - Test it by going to http://example.com/image/crop,x15,y15,w300,h300/fit,w200,h150,top-left/f_key/your-image.jpg
Change log
Please see CHANGELOG for more information what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.