tacticmedia / imgix-bundle
Integration of the imgix library into Symfony 4+ & PHP 7.1+
Installs: 2 783
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 2
Type:symfony-bundle
Requires
- php: ^7.1
- imgix/imgix-php: ^3.0
- symfony/framework-bundle: ^4.0
README
Integration of the imgix library into Symfony.
Installation
The best way to install this bundle is by using Composer.
For Symfony 2.x run:
$ php composer.phar require tacticmedia/imgix-bundle ~1.0
For Symfony 3.4+ run:
$ php composer.phar require tacticmedia/imgix-bundle ~2.0
For Symfony 4+ run:
$ php composer.phar require tacticmedia/imgix-bundle ~3.0
For Symfony 4+ with PHP 7.1 run:
$ php composer.phar require tacticmedia/imgix-bundle ^4.0
Then, enable the bundle:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Tacticmedia\ImgixBundle\TacticmediaImgixBundle(), ); }
Finally add your sources:
tacticmedia_imgix: enabled: true default_source: 'folder' sources: folder: domain: 'acme.imgix.net' proxy: domain: 'acme-proxy.imgix.net' sign_key: 'abcd1234'
Usage
In your Twig template just do:
<!-- Absolute URL with a web proxy source --> <img src="{{ imgix('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png', source='proxy', width=200, height=166) }}" width="200" height="166"/> <!-- Absolute path with a web folder source --> <img src="{{ imgix('images/modules/logos_page/Octocat.png', w=200, h=166) }}" width="200" />
You should put the enabled
and domains[]
setting in your parameters to be able to enable imgix for different environments.
License
This bundle is released under the MIT license. See the complete license in the bundle:
Resources/meta/LICENSE
Credits
This repository is based on https://github.com/GoldenLine/ImgixBundle which seems to be abandoned and not up-to-date with Symfony progress.