The main advantage of Asido
is to have a common and solid API for image transformations
no matter what environment you got.
This is achived by using the so-called „drivers“,
which utilize the selected environment to always deliver the same result.
There are drivers for either PHP extensions like
php_gd
,
php_imagick
, php_magickwand
, or php_imlib
(not yet supported), as well as shell tools like Image Magick, NetPBM and ImLib2 (so far only Image Magick is supported as shell driver).
Asido supports the following environments:
php_gd.dll
(gd.so
)
extension loaded (more info).
/**
* Enable the GD driver
*/
asido::driver('gd');
The GD driver has a hack version,
which enables flipping (vertical mirror), flopping (horizontal mirror), and grayscaling.
php_magickwand.dll
(magickwand.so
) extension loaded
(more info).
/**
* Enable the Magick Wand driver
*/
asido::driver('magick_wand');
The old ImageMagick API is still
available when using the php_imagick
extension.
php_imagick.dll
(imagick.so
) extension loaded (more info).
/**
* Enable the Imagick Extension driver
*/
asido::driver('imagick_ext');
The imagick_ext driver has a hack version, which enables fully-featured rotating and somewhat version of grayscaling.
/**
* Enable the Imagick Shell driver
*/
asido::driver('imagick_shell');
The imagick_shell driver has a hack version, which enables fully-featured rotating.
In several occasions, some particular environment can not deliver some of the required functionality. For these scenarios there is a family of drivers, called the „hack“ drivers. Those drivers have work-arounds for the missing functionalities using whatever they can find useful from the features of the environment. All those work-arounds are functional, but they are not as fast as the „core“ implementations of the ordinary drivers. Here are the „hack“ drivers and the applied work-arounds:
/**
* Enable the GD hack driver
*/
asido::driver('gd_hack');
Of all the drivers, probably this is the one that is used the most. This is because it combines a very popular environment (php_gd
), and some extra feature that miss in the original driver.
/**
* Enable the Imagick Extension hack driver
*/
asido::driver('imagick_ext_hack');
The extra touch to the rotating, which is added here, is to be able to set the background color of the rotated object.
/**
* Enable the Imagick Shell driver
*/
asido::driver('imagick_shell_hack');
As with the extension version above, for this hack driver the extra touch added is setting the background color of the rotated object.