Download the PHP package ekino/tiny-png-sonata-media-bundle without Composer
On this page you can find all versions of the php package ekino/tiny-png-sonata-media-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ekino/tiny-png-sonata-media-bundle
More information about ekino/tiny-png-sonata-media-bundle
Files in ekino/tiny-png-sonata-media-bundle
Package tiny-png-sonata-media-bundle
Short Description Tiny Png integration with SonataMedia by Ekino
License MIT
Homepage https://github.com/ekino/tiny-png-sonata-media-bundle
Informations about the package tiny-png-sonata-media-bundle
TinyPngSonataMediaBundle
This is a work in progress, so if you'd like something implemented please feel free to ask for it or contribute to help us!
Resources
- Documentation
Purpose
Automatize image optimization through tinyPNG service. You can only use the client or get the full process with sonata media and sonata notification.
Installation
Step 1: add dependency
Step 2: register the bundle
Symfony 2 or 3:
Symfony 4:
Step 3: configure the bundle
Step 4: define the sonata notification queue for asynchronous behaviour
Usage
Use the tinyPng client
Client can be used directly to optimize images through tinyPNG API. However, image optimization should not be done synchronously as it takes time.
If you know what you are doing, you can use the ekino.tiny_png_sonata_media.tinify.client and its optimize method:
Full process with sonata media & notification
This bundle listen doctrine events (postPersist & postUpdate) on media entity. As soon as the media's provider is in
the whitelist (defined in configuration), it will publish a sonata notification message
(type: ekino.tiny_png_sonata_media.optimize_image) to be handled by a consumer
(Ekino\TinyPngSonataMediaBundle\Consumer\OptimizeImageConsumer). This consumer will contact tinyPNG API for
optimization, replace it on the server and update media size in database.
Suggest install LiipMonitorBundle
This bundle provides a service using liip/monitor-bundle to check the count of compressions made this month.
Note
- Only Sonata\MediaBundle\Filesystem\Local adapter is supported for now.
- Only png, jpg & jpeg files extensions are handled by this bundle as the tinyPNG only handle those ones.
- Regeneration of thumbnails after optimization is not yet supported.
All versions of tiny-png-sonata-media-bundle with dependencies
doctrine/orm Version ^2.6
sonata-project/admin-bundle Version ^3.1
sonata-project/media-bundle Version ^3.0
sonata-project/notification-bundle Version ^3.1
symfony/framework-bundle Version ^4.4 || ^5.3
symfony/translation Version ^4.4 || ^5.3
tinify/tinify Version ^1.5