Implement your own image transformationsΒΆ
Imbo also supports custom image transformations. All you need to do is to create an event listener, and configure your transformation:
<?php
class My\Custom\Transformation implements Imbo\EventListener\ListenerInterface {
public static function getSubscribedEvents() {
return array('image.transformation.cooltransformation' => 'transform');
}
public function transform($event) {
$image = $event->getArgument('image');
$params = $event->getArgument('params'); // If the transformation allows params in the URL
// ...
}
}
return array(
// ..
'eventListeners' => array(
'coolTransformation' => 'My\Custom\Transformation',
),
// ...
);
Whenever someone requests an image using ?t[]=coolTransformation:width=100,height=200 Imbo will trigger the image.transformation.cooltransformation event, and assign the following value to the params argument of the event:
array(
'width' => '100',
'height' => '200',
)
Take a look at the existing transformations included with Imbo for more information.