Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lireincore/lireincoreimgcachebundle
The imgcache integration for Symfony framework
https://github.com/lireincore/lireincoreimgcachebundle
bundle cache effect image php postprocessor preset resize symfony thumb thumbnail
Last synced: 7 days ago
JSON representation
The imgcache integration for Symfony framework
- Host: GitHub
- URL: https://github.com/lireincore/lireincoreimgcachebundle
- Owner: lireincore
- License: mit
- Created: 2018-08-07T16:45:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-10T13:58:04.000Z (about 5 years ago)
- Last Synced: 2025-01-24T22:33:01.535Z (7 days ago)
- Topics: bundle, cache, effect, image, php, postprocessor, preset, resize, symfony, thumb, thumbnail
- Language: PHP
- Size: 27.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.MD
- License: LICENSE
Awesome Lists containing this project
README
# Image effect, thumb and cache bundle for Symfony
[![Build Status](https://secure.travis-ci.org/lireincore/LireinCoreImgCacheBundle.png?branch=master)](http://travis-ci.org/lireincore/LireinCoreImgCacheBundle)
[![Latest Stable Version](https://poser.pugx.org/lireincore/imgcache-bundle/v/stable)](https://packagist.org/packages/lireincore/imgcache-bundle)
[![Total Downloads](https://poser.pugx.org/lireincore/imgcache-bundle/downloads)](https://packagist.org/packages/lireincore/imgcache-bundle)
[![License](https://poser.pugx.org/lireincore/imgcache-bundle/license)](https://packagist.org/packages/lireincore/imgcache-bundle)## About
The [lireincore/imgcache](https://github.com/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
``` bash
$ 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:
```yaml
# config/packages/lireincore_imgcache.yamllireincore_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):```yaml
# config/services.yamlservices:
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](https://github.com/lireincore/imgcache/blob/master/README.md) for more information about the available effects and other config options.
Use in your code:
```php
$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](https://github.com/lireincore/imgcache/blob/master/README.md) for more information about the available functions.
## License
This project is licensed under the MIT License - see the [License File](LICENSE) file for details