goldenline / imgix-bundle
将 imgix 库集成到 Symfony
1.0.0
2014-12-17 07:09 UTC
Requires
- imgix/imgix-php: ~1.0
- symfony/framework-bundle: ~2.3
This package is not auto-updated.
Last update: 2024-09-24 04:04:50 UTC
README
将 imgix 库集成到 Symfony。
安装
安装此包的最佳方式是使用 Composer。只需运行
$ php composer.phar require goldenline/imgix-bundle dev-master
然后,启用该包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new GoldenLine\ImgixBundle\GoldenlineImgixBundle(), ); }
最后添加你的源
goldenline_imgix: default_source: folder sources: folder: domains: [ acme.imgix.net ] proxy: domains: [ acme-proxy.imgix.net ] sign_key: abcd1234
使用方法
在你的 Twig 模板中只需这样做
<!-- 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', width=200, height=166) }}" width="200" height="166"/>
许可证
此包在 MIT 许可证下发布。请参阅包中的完整许可证。
Resources/meta/LICENSE