www.julianstricker.com - Home

User login

julianstricker's tweets

  • last.fm now runs great on my HTC Hero :-) 1 week 5 days ago
  • @splattne Kingston ssdNOW V+ SNVP325-S2 2 weeks 5 days ago
  • Mein Acer 8942G bootet dank neuer SSD in nur 9 Sekunden 2 weeks 6 days ago
  • Buzz lebt!!! 3 weeks 6 days ago
  • mein Acer Aspire 8942G ist angekommen :-) 6 weeks 2 days ago

New Symfony Plugin "jsThumbnailPlugin" for on-the-fly Thumbnails Creation

Today I have released my first plugin for the Symfony-Framework. The jsThumbnailPlugin creates Thumbnails on the fly using the GD library. It uses the Symfony cache system to cache the thumbnails.

The plugin consists of a action and a helper. It creates a thumbnail of a image in the given size and stores it in cache for the next calls, until the image changes. You can download it from http://www.symfony-project.org/plugins/jsThumbnailPlugin

The use is very simple:
1. Install it:

$ symfony plugin-install http://plugins.symfony-project.com/jsThumbnailPlugin

2. Enable the module in the setting.yml file of your application:

all:
  .settings:
    enabled_modules:        [ default, jsThumbnail ]

3. Now you can view the thumbnail simply by open a link like this:

http://www.yourhost.com/yourapp.php/jsThumbnail/thumbnail?img=uploads/pi...

4. The plugin has a helper that creates a image-tag for a thumbnail. Include the helper in your template-file:

<?php use_helper('Thumbnail') ?>

5. Call the Helper. The helper needs some params: the imagepath on server, maximum-width and maximum-height. The last parameter are additional HTML compliant tag parameters:

<?php echo thumbnail_tag('uploads/pictures/image.jpg',100, 80, array('style' => 'border: 1px solid #ff0000')) ?>

6. The Plugin automatically checks if the Original image was modificated.

7. To delete the cached thumbnails call:

$ symfony cc

follow me on Twitter

Certificates

php5-zce-logo-new

www.julianstricker.com feeds