Download the PHP package mkurzeja/image-bundle without Composer
On this page you can find all versions of the php package mkurzeja/image-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mkurzeja/image-bundle
More information about mkurzeja/image-bundle
Files in mkurzeja/image-bundle
Package image-bundle
Short Description Image handling bundle
License MIT
Homepage https://github.com/Gregwar/ImageBundle
Informations about the package image-bundle
Gregwar's ImageBundle
GregwarImageBundle
provides easy Image manipulation and API for Symfony2 and Twig
Installation
Step 1: Download the GregwarImageBundle
Using the vendors script
Add the following lines to your deps
file:
Now, run the vendors script to download the bundle:
Using submodules
If you prefer instead to use git submodules, then run the following:
Using Composer
Add the following to the "require" section of your composer.json
file:
You can also choose a version number, (tag, commit ...)
And update your dependencies
Step 2: Configure the Autoloader
If you use composer, you can skip this step.
Add it to your autoload.pp
:
Step 3: Enable the bundle
Registers the bundle in your app/AppKernel.php
:
Step 4: Configure the bundle and set up the directories
Adds the following configuration to your app/config/config.yml
:
gregwar_image: ~
If you want to customize the cache directory name, you can specify it:
gregwar_image:
cache_dir: my_cache_dir
Creates the cache directory and change the permissions so the web server can write in it:
mkdir web/cache
chmod 777 web/cache
You can also disable the exception thrown if the given file does not exist:
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:
<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.
The available methods are the same as the Gregwar's Image.
You can also use the logical file names for bundle resources :
<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:
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:
Requirements
GregwarImageBundle
needs GD
and exif extension for PHP to be installed on the web server
License
This bundle is under MIT license
All versions of image-bundle with dependencies
ext-gd Version *