Imbo should support automatically adding transformations for all images (configurable per user (public key), before and after the regular transformation chain. This could for instance be used to automatically apply watermarks to all images for specific public keys.
<?php
namespace Imbo\Image\Transformation;
use Imbo\Model\Image;
class customTransformation {
public function __invoke(Image $image) {
// custom transformation code
}
}
// used in the configuration below
$customTransformation = new customTransformation();
function customFunc(Image $image) {
// some custom code
}
return array(
// ...
'autoImageTransformations' => array(
// settings per public key
'publicKey' => array(
// transformations applied BEFORE transformations specified in t[]
'pre' => array(
// implementation of the Imbo\Image\Transformation\TransformationInterface interface
'thumbnail' => new Thumbnail(),
// closure which receives the image to work with
'customStuff' => function(Image $image) {
// custom transformation code
},
// callable code (instantiated above)
'moreCustomStuff' => $customTransformation,
// reference to the function defined above
'awesomeCustomTransformation' => 'customFunc',
),
// transformations applied AFTER transformations specified in t[]
'post' => array(
// same possibilities as above
),
),
),
// ...
);