webmil/filepickerio-bundle
Composer 安装命令:
composer require webmil/filepickerio-bundle
包简介
Symfony WebmilFilepickerIoBundle
关键字:
README 文档
README
Installation
Step 1) Download bundle
Method a) Using composer (symfony 2.1 pattern)
Add on composer.json (see http://getcomposer.org/)
"require" : {
// ...
"webmil/filepickerio-bundle": "dev-master",
}
Method b) Using the deps file (symfony 2.0 pattern)
Add the following lines to your deps file and then run php bin/vendors install:
[WebmilFilepickerIoBundle]
git=https://github.com/imsashko/WebmilFilepickerIoBundle.git
target=bundles/Webmil/FilepickerIoBundle
version=origin/2.0
Step 2) Register the namespaces
If you installed the bundle by composer, use the created autoload.php (jump to step 3).
Add the following namespace entry to the registerNamespaces call
in your autoloader:
<?php // app/autoload.php $loader->registerNamespaces(array( // ... 'Webmil\\FilepickerIoBundle' => __DIR__.'/../vendor/bundles', // ... ));
Step 3) Register the bundle
To start using the bundle, register it in your Kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Webmil\FilepickerIoBundle\WebmilFilepickerIoBundle(), ); // ... }
Step 4) Configure the bundle
# app/config/config.yml webmil_filepicker_io: api_key: yourKey
Usage
Initializing in twig template:
{{ filepicker_io_initialize() }}
Adding an upload field to your form:
Set type to 'filepicker' in form builder. To enable drag&drop set 'dragdrop' => true. See the filepicker.io documentation for the full options list.
$form = $this->createFormBuilder() ->add('filepicker', 'filepicker', array( 'dragdrop' => true, 'attr' => array( 'data-fp-mimetype' => 'image/png' ) )) ->getForm();
Displaying an image:
{{ filepicker_io_image_tag('https://www.filepicker.io/api/file/hFHUCB3iTxyMzseuWOgG', {'w': '200'}, {'class': 'classname'}) }}
See the filepicker.io documentation for the full options list.
Allowing the user to download a file (or upload it to any of the supported services)
{{ filepicker_io_save_button('http://path/to/file.png', 'Download file', 'image/png', {'data-fp-suggestedFilename': 'name.png'}) }}
See the filepicker.io documentation for the full options list.
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-12-05