New Feature: Automatic Image Version Creation

Posted by Nils on 15 December 2008

Finally, a long wanted feature found it's way into the repository. You can now create scaled image version on the fly, e.g. for teasing images.

Usage ist quite simple. First get an Image object and then try to select a version:

$myImg->selectVersionOrCreate("teaser",120,100);

If an image version name "teaser" is available, the version simply gets selected.

Otherwise a new version with the image dimension 120x100 is created and stored under the name "teaser". So on the next call no new image operation is necessary.

There's another side effect. If you dislike the automatic generated version, you may edit it yourself in the mediabase. As long as the version is named "teaser" it will get selected. So you don't loose your capability to control the images on your website.

parameterize the image creation


selectVersionOrCreate ($name,$x,$y,$method = 5, $quality = 85,$sharpening = 1)

There are some options to influence the image creation. You can determine the jpeq quality (it's always a jpeg), sharpening and creation method (e.g. fixed size or fixed target frame).

Since the parameters are most likely to be changed or expanded, check the API doc for current behaviour:


0 Comment(s) Categories: Development, Features

Post your comment

Name*:


Email: (won't be published)


Your website URL:


Comment*:

Captcha-Code:



*mandatory

back
Bookmark and Share