kphoen/gaufrette-extras-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Integrates the gaufrette-extras library into Symfony

Installs: 4 198

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 1

Open Issues: 0

Type:symfony-bundle

1.0.0 2014-04-20 03:30 UTC

This package is auto-updated.

Last update: 2019-02-20 19:36:18 UTC


README

GaufretteExrasBundle is a Symfony2 bundle integrating the Gaufrette Extras library.

Status

This project is DEPRECATED and should NOT be used.

If someone magically appears and wants to maintain this project, I'll gladly give access to this repository.

Installation

The recommended way to install this library is through composer.

Just create a composer.json file for your project:

{
    "require": {
        "kphoen/gaufrette-extras-bundle": "~1.0"
    }
}

And run these two commands to install it:

$ wget http://getcomposer.org/composer.phar
$ php composer.phar install

Register the KPhoenGaufretteExtrasBundle:

# 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.

A Twig extension is also provided, allowing the following things in templates:

    <img src="{{ article.thumb|resolve("thumbs") }}" />

Here is the associated configuration:

# 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

Image form type

ImageType to show the previously uploaded image.

Utilisation sample:

<?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.