Add on composer.json (see http://getcomposer.org/)
"require" : {
// ...
"webmil/filepickerio-bundle": "dev-master",
}
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
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',
// ...
));
To start using the bundle, register it in your Kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Webmil\FilepickerIoBundle\WebmilFilepickerIoBundle(),
);
// ...
}
# app/config/config.yml
webmil_filepicker_io:
api_key: yourKey
{{ filepicker_io_initialize() }}
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();
{{ 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.
{{ 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.