dev-master
9999999-dev
MIT
The Requires
With this Bundle you can define resolvers in order to store the liip image cache files in Gaufrette filesystems., (*1)
This bundle depends on LiipImagineBundle and KnpGaufretteBundle., (*2)
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*3)
$ composer require simettric/gaufrette-to-liip-imagine-bundle "dev-master"
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*4)
An example of a resolver configuration:, (*5)
You can use one of the gaufrette adapters for doing this, you can store the files in Amazon s3, Azure, Dropbox, Google Storage, even a FTP/sFTP server., (*6)
# app/config/config.yml knp_gaufrette: stream_wrapper: ~ adapters: cache_google: google_cloud_storage: service_id: 'app.google_cloud_storage.service' bucket_name: '%google.storage_bucket_name%' options: directory: %cache_dir_name% filesystems: media_cache: adapter: cache_google
# app/config/services.yml app.storage.resolver: class: Simettric\Gaufrette2LiipImagineBundle\Resolver\LiipGaufretteResolver #@gaufrette.{filesystem_name}_filesystem arguments: ['@gaufrette.media_cache_filesystem', '%google.storage_prefix_url%', '%cache_dir_name%'] tags: - { name: "liip_imagine.cache.resolver", resolver: "gaufrette_resolver" }
You can configure it in order to store the cache files in that filesystem as default, (*7)
# app/config/config.yml liip_imagine: filter_sets: cache: gaufrette_resolver
Or you can specify in which filter do you want to use that filesystem. This is useful in scenarios where do you want to use different filesystems to store your thumbnail images., (*8)
# app/config/config.yml liip_imagine: filter_sets: cache: ~ avatar: cache: gaufrette_resolver quality: 75 filters: relative_resize: { widen: 400 }
You can also apply LiipImagine filters to images stored in remote urls with a simple remote data loader included in this bundle. To get it working, you need to set it in your liip_imagine configuration, (*9)
# app/config/config.yml liip_imagine: data_loader: sim_gau2liip_remote_loader # in your twig template <img src="{{ "https://domain.com/image.png"|imagine_filter('your_filter') }}">
Note: if the loader canÂŽt find the image, it will load the general default_image configured in the LiipImagine bundle configuration., (*10)
This loader needs more improvement, all PRs are welcomed., (*11)
MIT