flazzarotto/binary-filter
Composer 安装命令:
composer require flazzarotto/binary-filter
包简介
Easy Liip Imagine server-side image filter for both files and binary data
README 文档
README
This Symfony3 bundle use liip/imagine to allow easy php-side image filter.
## Set up
-
Run
composer require flazzarotto/binary-filter -
Modify you AppKernel.php:
$bundles = [ // add following lines new \Liip\ImagineBundle\LiipImagineBundle(), new Flazzarotto\BinaryFilterBundle\BinaryFilterBundle() ];
-
Configure your filters the same way you do with liip, but using our binary image loader as data loader. For example:
# config.yml liip_imagine : # your filter sets are defined here filter_sets : # use the default cache configuration cache : ~ my_filter: data_loader: binary_image_data_loader filters: thumbnail: size: [1920, 1080] mode: outbound
HOW TO USE
The main goal of this package is to allow you to resize, generate thumbnails on the fly, in controllers, commands, services... You can provide both binary data and filepaths to the service.
Example:
$filter = $this->get('image.back_filter'); // the BinaryFilter service $filter ->setDefaultFilter('my_filter') // filter as defined in your config.yml - optional ->loadBinary($data,$outputFile) // $data as binary, $outputFile as path relative to directory - return a BinaryFilter object // OR ->loadFile($path) // provide absolute path to your input image - return a BinaryFilter object ->applyFilter($filter) // you can override default filter - optional if default filter has been given ->getMimeType(); // optional; useful to determine extension or for direct download ->outputFile(true); // save filtered image to output file; set parameter to true to allow overriding if file exists // OR ->getFilteredBinary(); // returns picture as binary data
统计信息
- 总下载量: 44
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2016-12-07