weysan/doctrine-img-bundle
最新稳定版本:v1.2-beta
Composer 安装命令:
composer require weysan/doctrine-img-bundle
包简介
Helper to create thumbnails thanks to doctrine annotation in a doctrine entity
README 文档
README
Create a thumbnail after uploading an image through a form in a Symfony3 project
Install the bundle
Using composer :
composer require weysan/doctrine-img-bundle
Enable the bundle in the app\AppKernel.php :
$bundles = array(
...,
new Weysan\DoctrineImgBundle\WeysanDoctrineImgBundle(),
...,
);
Import the configuration file in your app\config\config.yml :
imports:
- { resource: "@WeysanDoctrineImgBundle/Resources/config/config.yml" }
- { resource: "@WeysanDoctrineImgBundle/Resources/config/services.yml" }
You can specify where the public directory is in your config.yml file :
weysan_doctrine_img:
public_root: %kernel.root_dir%/../web/
How to use it ?
Create your doctrine entity, and put the annotation :
@ImgResize("image", width="500", height="300", uploadDir="media/upload/article", uploadDirDate=true, saveField="path", strict=true, crop=false)
- image : the field where you put the annotation
- width : the thumbnail's width
- height : the thumbnail's height
- strict : (true or false, default is true) if strict is true, the thumbnail will have the strict height and width. If strict is false, then the height and width will be the maximum size of the saved thumbnail.
- crop : (true or false, default is false) Would you like that the thumbnail could be cropped (interesting if strict is set to true)
- uploadDir : the directory where to put the thumbnail (in the public directory)
- uploadDirDate : (true or false, default is false) if the directory manages folders by date (uploadDir/YYYY/MM/). The folder must be existing.
- saveField : the entity's field where to save the thumbnail's name
统计信息
- 总下载量: 135
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-17