Download the PHP package enemis/sonata-media-liip-imagine without Composer
On this page you can find all versions of the php package enemis/sonata-media-liip-imagine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download enemis/sonata-media-liip-imagine
More information about enemis/sonata-media-liip-imagine
Files in enemis/sonata-media-liip-imagine
Package sonata-media-liip-imagine
Short Description The easiest way to integrate sonata media with liip imagine
License MIT
Homepage https://github.com/enemis/sonata-media-liip-imagine
Informations about the package sonata-media-liip-imagine
Sonata Media integration with Liip Imagine
Overview
Integrates Sonata Media Bundle and Liip Imagine Bundle without pain.
If you have tried to integrated LiipImagineBundle and Sonata Media Bundle as was described on this page you know what I is talking about. I've decided to free the Symfony world from such a headache.
The bundle provides a support for LiipImagineBundle through a specific Thumbnail service like as original Sonata Media. It also works good with Sonata Admin Bundle. So you no need any other actions for your admin part if you use Sonata Admin Bundle. You feel free to try this. Configure bundle takes about couple minutes.
1 Installation
$ composer require enemis/sonata-media-liip-imagine
2 Enable the Bundle
3 Sonata Media config
You need to configure your Sonata Media Bundle. Most important part is to configure context, cdn, providers.
You mustn't add formats to contexts that should use Liip formats. Tell to providers to use custom thumbnail service
'sonata.media.thumbnail.liip_imagine'. ** Please do not forget this bundle allow use Liip imagine only with image provider and youtube provider.
If you require something else please let me know or suggest pull request **
More details you are able to find on official documentation.
4 VideoProvider and Youtube 3 Api
If you are using youtube provider from sonata media bundle, you might figure out that quality of thumbnails not always well. It happens because oembed API doesn't receive high res thumbnail, but default size. I've changed oembed to Youtube API 3, and now Youtube provider fetches high res thumbnail and also youtube statistics(views, likes, dislikes); Before using you need to generate Google Api Key and enable Youtube Api 3 at https://console.developers.google.com;
- https://console.developers.google.com/projectcreate - create new project
- press add services and apis and choose YouTube Data API v3 http://prntscr.com/m9sgzs
- press enable
- create credential to use this api http://prntscr.com/m9sipt
- copy generated key and press done http://prntscr.com/m9sjdr
- put generated key into your parameters.yml.dist
5 Configure you Liip Imagine and add filters sets
You need to add filter sets in format CONTEXT_FORMAT. You are able to use any filters or post-processors that Liip Imagine provides.
More details about Liip Imagine
6 Override Sonata's Media provider.
In general, this bundle override sonata's providers(ImageProvider and YoutubeProvider). If you wanna override some provider's part, you have to extend own provider with Enemis\SonataMediaLiipImagineBundle\Provider\ImageProvider. or Enemis\SonataMediaLiipImagineBundle\Provider\YouTubeProvider for youtube provider and override the corresponding parameter. Sonata Media has two parameters for that. Just override it if you want.
- sonata.media.provider.image.class: Application\Sonata\MediaBundle\Provider\ImageProvider
- sonata.media.provider.youtube.class: Application\Sonata\MediaBundle\Provider\YouTubeProvider
You are able to put this parameters into parameters.yml, config.yml. I prefere add them in admin.yml from Application\Sonata\MediaBundle.
and don't forget extend your provider by provider from Enemis\SonataMediaLiipImagineBundle\Provider namespace.
7 troubleshooting guide
This bundle must go after Sonata Media bundle \ ApplicationSonataMediaBundle otherwise you will get exception: The service "enemis.sonata_media_liip_imagine.chain_resizer" has a dependency on a non-existent service "sonata.media.adapter.image.default".
If you have some question feel free to mail me on [email protected]. Also you are able to create issues and suggest pull request.
Enjoy
All versions of sonata-media-liip-imagine with dependencies
symfony/framework-bundle Version ~4.0 || ^5.0
liip/imagine-bundle Version ~2
sonata-project/media-bundle Version ~3.23 || ^4.0