lireincore / imgcache-bundle
The lireincore/imgcache integration for the Symfony framework
Installs: 22
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/lireincore/imgcache-bundle
Requires
- lireincore/imgcache: ^0.6
 - symfony/config: ^3.4 || ^4.0
 - symfony/dependency-injection: ^3.4 || ^4.0
 - symfony/http-kernel: ^3.4 || ^4.0
 
Requires (Dev)
- phpunit/phpunit: ^7
 - roave/security-advisories: dev-master
 
README
About
The lireincore/imgcache integration for Symfony framework.
Install
Add the "lireincore/imgcache-bundle": "^0.4" package to your require section in the composer.json file
or
$ php composer.phar require lireincore/imgcache-bundle
Usage
To use this bundle, you need to create the lireincore_imgcache.yaml file in your config/packages folder and paste this boilerplate:
# config/packages/lireincore_imgcache.yaml lireincore_imgcache: srcdir: '%kernel.project_dir%/files' destdir: '%kernel.project_dir%/public/thumbs' webdir: '%kernel.project_dir%/public' presets: origin: effects: - { type: 'resize', params: { width: '50%', height: 100 } } - 'grayscale'
Add listener class and configure for event handling when thumb created
(required symfony/event-dispatcher: ^4.3 or another psr-14 compatible dispatcher):
# config/services.yaml services: Psr\EventDispatcher\EventDispatcherInterface: '@event_dispatcher' App\Event\ThumbCreatedListener: tags: - { name: kernel.event_listener, event: LireinCore\ImgCache\Event\ThumbCreatedEvent, method: onThumbCreated }
See lireincore/imgcache README.md for more information about the available effects and other config options.
Use in your code:
$imgcache = $this->container->get('lireincore_imgcache.service.imgcache'); // get thumb url for image '{srcdir}/blog/image.jpg' (preset 'origin') $url = $imgcache->url('blog/image.jpg', 'origin');
See lireincore/imgcache README.md for more information about the available functions.
License
This project is licensed under the MIT License - see the License File file for details