microstudi/silex-image-controller
最新稳定版本:v2.0.2
Composer 安装命令:
composer require microstudi/silex-image-controller
包简介
Microstudi/Image Controller Service Provider for Silex.
README 文档
README
A auto-image resize controller using Intervention/image service provider for Silex
Requirements
- PHP >= 5.5.9 (Same as Silex 2.0)
InterventionImageServiceProvider
Install
Using composer:
composer require microstudi/silex-image-controller
Usage
use Microstudi\Silex\ImageController\ImageController; use Microstudi\Silex\InterventionImage\InterventionImageServiceProvider; $app = new Silex\Application(); $app->register(new InterventionImageServiceProvider); ; //Automatic images $app->mount('/your_path', new ImageController(array( 'image_path' => '/path/to/original/images', 'image_cache_path' => '/path/to/cache/folder' ) )); $app->run();
Twig Helper: If twig is present a convenient function can be used to generate proper urls for auto-resized images image_path(image, size):
{{ image_path('path/to/image.png', 100, 100) }}
{{ image_path('path/to/image.png', 100, 100, 'c') }}
URLs examples:
your_path/200x300/products/image_product.jpg <- width or height will be
changed if necessary but
never increased
your_path/200x300xc/products/image_product.jpg <- cropped, ensures exact sizes
your_path/200x0/products/image_product.jpg <- auto-calculate height
your_path/0x300/products/image_product.jpg <- auto-calculate width
Options
intervention.image- Instance ofIntervention\Image\ImageManager.intervention.response- For use ImageManager directly such as$app['intervention.response']($image)intervention.driver- Driver used (imagick or gd)
Tests
$ composer install $ vendor/bin/phpunit
Changelog
2.0.2
- README example fix.
2.0.0
- Updated for Silex 2.0
1.0.1
- Readme fix
- Locked Silex to version 1.1
1.0.0
- First release
LICENSE
The MIT LICENSE (MIT)
统计信息
- 总下载量: 2.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-29