GaufretteExrasBundle is a Symfony2 bundle integrating the Gaufrette Extras library., (*1)
Status
This project is DEPRECATED and should NOT be used., (*2)
If someone magically appears and wants to maintain this project, I'll gladly give access to this repository., (*3)
Installation
The recommended way to install this library is through composer., (*4)
Just create a composer.json
file for your project:, (*5)
{
"require": {
"kphoen/gaufrette-extras-bundle": "~1.0"
}
}
And run these two commands to install it:, (*6)
$ wget http://getcomposer.org/composer.phar
$ php composer.phar install
Register the KPhoenGaufretteExtrasBundle
:, (*7)
# app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new KPhoen\GaufretteExtrasBundle\KPhoenGaufretteExtrasBundle(),
);
}
Features
URL resolvers
Resolvers provide a quick and easy way to resolve filesystem entries to a URL.
See GaufretteExtras., (*8)
A Twig extension is also provided, allowing the following things in templates:, (*9)
<img src="{{ article.thumb|resolve("thumbs") }}" />
Here is the associated configuration:, (*10)
# gaufrette bundle
knp_gaufrette:
adapters:
thumbs_adapter:
local:
directory: %kernel.root_dir%/../web/thumbs
create: true
filesystems:
thumbs:
adapter: thumbs_adapter
# gaufrette extras
k_phoen_gaufrette_extras:
resolvers:
thumbs: # the filesystem name
prefix: # the resolver to use
path: /thumbs # and its configuration
ImageType to show the previously uploaded image., (*11)
Utilisation sample:, (*12)
<?php
class MyFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('avatar', 'image', array(
'gaufrette' => 'avatars',
'image_path' => 'avatar', // because there is a getAvatar() method in the data class
'image_alt' => 'Avatar',
'image_width' => '100px',
'image_height' => '100px',
'no_image_placeholder' => 'noImage.jpg',
));
}
}
License
This bundle is released under the MIT License. See the bundled LICENSE file
for details., (*13)