itf / vich-imagine-bundle
轻松集成 VichUploaderBundle(上传)和 LiipImagineBundle(处理器)组件
0.1.4
2016-03-21 10:28 UTC
Requires
- php: >=5.3
- liip/imagine-bundle: ^1.3
- symfony/symfony: ^2.7
- vich/uploader-bundle: ^0.14.0
This package is not auto-updated.
Last update: 2024-09-14 17:53:41 UTC
README
此包将 VichUploaderBundle 作为上传组件,将 LiipImagineBundle 作为处理器(调整大小等)组件集成。
安装
composer require itf/vich-imagine-bundle "dev-master"
php app/console assets:install
在 AppKernel.php 中激活这些包
public function registerBundles() { $bundles = array( //[...] new Liip\ImagineBundle\LiipImagineBundle(), new Vich\UploaderBundle\VichUploaderBundle(), new VichImagineBundle\VichImagineBundle(), ), // ... }
配置 VichUploaderBundle
请参阅其文档来配置此包。以下是一个示例
vich_uploader: db_driver: orm # or mongodb or propel or phpcr mappings: product_image: uri_prefix: /images/products upload_destination: %kernel.root_dir%/../web/images/products namer: vich.custom.random_namer
配置 LiipImagineBundle
请参阅其文档来配置此包。以下是一个示例
liip_imagine: resolvers: default: web_path: web_root: %kernel.root_dir%/../web cache_prefix: cache/ loaders: default: filesystem: data_root: %kernel.root_dir%/../web/ driver: gd cache: default data_loader: default default_image: null controller: filter_action: liip_imagine.controller:filterAction filter_runtime_action: liip_imagine.controller:filterRuntimeAction filter_sets: product_image: filters: jpeg_quality: 75 #png_compression_level: ~ format: jpg relative_resize: { widen: 800 }
配置示例
- 配置示例: config_sample.yml
- 实体示例: Image.php
- 表单类型示例: ImageType.php
就是这样。
许可
MIT