sfImageTransformExtraPlugin - 0.9.1

Christian Schaefer <caefer@ical.ly>

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Dependencies Releases Changelog Contribute
Show source

Image manipulation made even easier - sfImageTransformExtraPlugin

sfImageTransformExtraPlugin

Introduction

On a website you ususally find lots of images and a set of formats. Say a user avatar is always 80x80 PNG while a homepage top image is always 320x140 JPG with round corners. As it is far too costly to prepare all these different formats by hand there are automated ways to generate them from source images uploaded by a user. One of the best tools for this in the symfony world is the sfImageTransformPlugin which enables you to perform many sophisticated transformations on your images such as resizing, color manipulation, overlays and more.

Using such an automatism means you have to write code and perform all necessary transformation on upload, no matter if the generated files are ever requested. It also means that design changes that also change the formats lead to change of business logic rather than just templates.

This is where sfImageTransformExtraPlugin springs to action as it provides a way to configure formats with multiple transformations. In your templates you only refer to the format by name which results in an SEO friendly image URL. The image itself will be generated on first request and (in production environments) written to the filesystem.

Here are some of the key features:

  • Configure image transformation for your thumbnail formats
  • Format changes without the need to change code
  • Unobstrusive implementation (No need to write code)
  • Generating images on request
  • Can be run as a web service for a content delivery network (CDN)
  • Supporting image file sources from Doctrine and remote files
  • SEO friendly URLs
  • Generated API documentation
  • Unit tested
  • Easily to extend

Installation

To install the plugin for a symfony project, the usual process is to use the symfony command line:

symfony 1.4

symfony plugin:install sfImageTransformPlugin

Alternatively, if you don't have PEAR installed, you can download the latest package attached to this plugin's wiki page and extract it under your project's plugins/ directory.

Clear the cache to enable the autoloading to find the new classes:

php symfony cc

Note: The plugin requires sfImageTransformPlugin to be installed as well. The dependencies described there apply as well.