2017 © Pedro PelĂĄez
 

symfony-bundle image-bundle

Image handling bundle

image

mkurzeja/image-bundle

Image handling bundle

  • Tuesday, September 24, 2013
  • by mkurzeja
  • Repository
  • 1 Watchers
  • 0 Stars
  • 698 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 40 Forks
  • 0 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

Gregwar's ImageBundle

GregwarImageBundle provides easy Image manipulation and API for Symfony2 and Twig, (*1)

Installation

Step 1: Download the GregwarImageBundle

Using the vendors script, (*2)

Add the following lines to your deps file:, (*3)

    [GregwarImageBundle]
        git=http://github.com/Gregwar/ImageBundle.git
        target=/bundles/Gregwar/ImageBundle

Now, run the vendors script to download the bundle:, (*4)

``` bash $ php bin/vendors install, (*5)


***Using submodules*** If you prefer instead to use git submodules, then run the following: ``` bash $ git submodule add git://github.com/Gregwar/ImageBundle.git vendor/bundles/Gregwar/ImageBundle $ git submodule update --init

Using Composer, (*6)

Add the following to the "require" section of your composer.json file:, (*7)

    "gregwar/image-bundle": "dev-master"

You can also choose a version number, (tag, commit ...), (*8)

And update your dependencies, (*9)

    php composer.phar update

Step 2: Configure the Autoloader

If you use composer, you can skip this step., (*10)

Add it to your autoload.pp :, (*11)

<?php
...
'Gregwar' => __DIR__.'/../vendor/bundles',

Step 3: Enable the bundle

Registers the bundle in your app/AppKernel.php:, (*12)

<?php
...
public function registerBundles()
{
    $bundles = array(
        ...
        new Gregwar\ImageBundle\GregwarImageBundle(),
        ...
    );
...

Step 4: Configure the bundle and set up the directories

Adds the following configuration to your app/config/config.yml:, (*13)

gregwar_image: ~

If you want to customize the cache directory name, you can specify it:, (*14)

gregwar_image:
    cache_dir:  my_cache_dir

Creates the cache directory and change the permissions so the web server can write in it:, (*15)

mkdir web/cache
chmod 777 web/cache

You can also disable the exception thrown if the given file does not exist:, (*16)

gregwar_image:
    throw_exception: false

Usage

Basics

This bundle is based on the Gregwar's Image class and provides simple but powerful Twig extension. You can for instance use it this way:, (*17)

<img src="{{ image('linux.jpg').resize(100,100).negate }}" />

And that's all ! The helper will automatically create the cached file on-the-fly if it doesn't exists yet., (*18)

The available methods are the same as the Gregwar's Image., (*19)

You can also use the logical file names for bundle resources :, (*20)

<img src="{{ image('@AcmeDemoBundle/Resources/images/linux.jpg').resize(100,100).negate }}" />

Using Image API

The image instance provides also a simple API, you can call some methods to get informations about the handled image:, (*21)

Image width: {{ image('linux.jpg').width }}px

Manipulating Image in Controllers

The Image Handler is accessible via a service called image.handling. So you can do in your controllers:, (*22)

<?php
...
$this->get('image.handling')->open('linux.jpg')
    ->grayscale()
    ->rotate(12)
    ->save('out.jpg')

Requirements

GregwarImageBundle needs GD and exif extension for PHP to be installed on the web server, (*23)

License

This bundle is under MIT license, (*24)

The Versions

24/09 2013

dev-pr

dev-pr https://github.com/Gregwar/ImageBundle

Image handling bundle

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

symfony2 image

24/09 2013

dev-master

9999999-dev https://github.com/mkurzeja/ImageBundle

Image handling bundle

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

symfony2 image

15/08 2013

v1.0.3

1.0.3.0 https://github.com/Gregwar/ImageBundle

Image handling bundle

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

symfony2 image

13/08 2013

v1.0.2

1.0.2.0 https://github.com/Gregwar/ImageBundle

Image handling bundle

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

symfony2 image

09/04 2012

v1.0.0

1.0.0.0 https://github.com/Gregwar/ImageBundle

Image handling bundle

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *

 

symfony2 image