2017 © Pedro PelĂĄez
 

symfony-bundle image-bundle

Image handling bundle

image

sentence/image-bundle

Image handling bundle

  • Tuesday, March 27, 2018
  • by Sentence
  • Repository
  • 0 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 40 Forks
  • 0 Open issues
  • 29 Versions
  • 25 % Grown

The README.md

Gregwar's ImageBundle

paypal, (*1)

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

Installation

Step 1: Download the GregwarImageBundle

Using the vendors script, (*3)

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

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

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

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


***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, (*7)

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

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

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

And update your dependencies, (*10)

    php composer.phar update

Step 2: Configure the Autoloader

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

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

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

Step 3: Enable the bundle

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

<?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:, (*14)

gregwar_image: ~

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

gregwar_image:
    cache_dir:  my_cache_dir

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

mkdir web/cache
chmod 777 web/cache

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

gregwar_image:
    throw_exception: true

If you don't throw an exception, you can set the fallback_image, to set the image that should be rendered in this case:, (*18)

gregwar_image:
    fallback_image: /path/to/your/fallback.jpg

If you have to change directories hierarchy or Web's name (e.g. web => public_html), you can set the web_dir to your new Web path:, (*19)

gregwar_image:
    web_dir: %kernel.root_dir%/../../public_html

With Symfony Flex

With Symfony Flex architecture, you can create the config/packages/gregwar_image.yaml file with the following contents:, (*20)

gregwar_image:
    web_dir: %kernel.root_dir%/../public

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:, (*21)

<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., (*22)

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

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

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

If you use web_image() helper, the image file path will be prefixed by the web/ absolute directory of your application:, (*25)

<!-- The image some/image.jpg will be prefixed by web directory prefix -->
<img src="{{ web_image('some/image.jpg').resize('10%') }}" />

Using Image API

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

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:, (*27)

<?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, (*28)

License

This bundle is under MIT license, (*29)

The Versions

27/03 2018
27/03 2018
26/02 2018
06/01 2017
21/10 2016
03/01 2016
03/01 2016
22/12 2015
19/10 2015

v2.0.22

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

25/08 2015

v2.0.21

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

31/05 2015

v2.0.20

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

03/02 2015

v2.0.19

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

13/12 2014

v2.0.18

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

28/09 2014

v2.0.17

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

06/02 2014

v2.0.16

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

06/02 2014

v2.0.15

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

12/12 2013

v2.0.14

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

01/12 2013

v2.0.13

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

29/11 2013

v2.0.12

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

06/11 2013

v2.0.10

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

06/11 2013

v2.0.9

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

06/11 2013

v2.0.8

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

25/10 2013

v2.0.7

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

21/10 2013

v2.0.5

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

18/10 2013

v2.0.4

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

symfony2 image

02/10 2013

v2.0.0

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

Image handling bundle

  Sources   Download

MIT

The Requires

 

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