Smart Lencioni Image Resizer

Dynamic image resizing, cropping and sharpening with caching for variations

Resizes images, intelligently sharpens, crops based on width:height ratios, color fills transparent GIFs and PNGs, and caches variations for optimal performance. Like this:



This plugin is a Cotonti implementation of the SLIR script by Joe Lencioni.
For more info: http://code.google.com/p/smart-lencioni-image-resizer/

» Discuss it here

NOTE: This plugin was developed for Siena. It will probably work in older versions too, but I didn't test it with those versions.
 

#1. Basic usage

By default, the SLIR script is accessible through index.php?z=index&r=slir
This is because the plugin uses the ajax hook. For pre-Siena installations it will be plugin.php?r=slir

The script takes the following query string parameters:

* 	w	Maximum width (integer)
* 	h	Maximum height (integer)
*	c	Crop ratio, like 1:1 or 3:4
*	q	Quality (integer, 0-100)
*	b	Background fill color (hexdec color code)
*	p	Progressive (1 or 0)

See below for examples. For more info see lib/slir.class.php in the download file.
 

#2. How to get nice URLs

Add these rewrite rules to Cotonti's .htaccess file:
 

RewriteRule ^image/([0-9]{1,4})x([0-9]{1,4})/([0-9]{1}):([0-9]{1})/(.*)\.(gif|jpg|jpeg|png)$ plug.php?r=slir&w=$1&h=$2&c=$3:$4&i=$5.$6 [NC,NE,QSA,L]
RewriteRule ^image/([0-9]{1,4})x([0-9]{1,4})/(.*)\.(gif|jpg|jpeg|png)$ plug.php?r=slir&w=$1&h=$2&i=$3.$4 [NC,NE,QSA,L]

With these rules you can request an image like this:

http://www.example.com/image/120x200/datas/users/example.jpg

Or with a fixed crop ratio:

http://www.example.com/image/120x200/1:1/datas/users/example.jpg

#3. Example usage

Resizing a JPEG to a max width of 100 pixels and a max height of 100 pixels:

<img src="image/100x100/path/to/image.jpg" alt="Alt text" />

Resizing and cropping a JPEG into a square:

<img src="image/100x100/1:1/path/to/image.jpg" alt="Alt text" />

1. 3axap  27.10.2010 20:31
not installed in Genoa 0.6.10 - slir Warning: No tags found in ./plugins/slir/slir.setup.php
2. GHengeveld  27.10.2010 21:27
In slir.php under 'Hooks=ajax' add this line:
Tags=

I've updated the download file to incorporate this fix.
3. booka  09.12.2010 05:56
still dame problem...
4. Heater  12.12.2010 01:16
not installed in Genoa 0.6.13 - slir Warning: No tags found in ./plugins/slir/slir.setup.php
:/ :/ :/
5. Dave  22.02.2012 00:56

for genoa u would have to:

[BEGIN_COT_EXT] replace with: [BEGIN_SED_EXTPLUGIN]

[END_COT_EXT] replace with: [END_SED_EXTPLUGIN]

[BEGIN_COT_EXT_CONFIG] replace with: [BEGIN_SED_EXTPLUGIN_CONFIG]

[END_COT_EXT_CONFIG] replace with: [END_SED_EXTPLUGIN_CONFIG]

its not tested :p just the idea ;p

Додавання комментарів доступно лише зареєстрованим користувачам