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_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:
GD2: this is the most common environment. In order to use it, you got to have the
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.
MagickWand: this is a native PHP-extension to the ImageMagick MagickWand API. This is the (most recent, read official) ImageMagick API for PHP and it is the recomended ImageMagick API for using with PHP. In order to use it, you got to have the
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
Imagick extension: this is a native PHP-extension to the ImageMagick API. This is the „old“ ImageMagick API for PHP, but it is still present in all the latest PHP builds. In order to use it, you got to have the
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.
Imagick shell: this driver utilizes the CLI commands of ImageMagick (more info).
/** * 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:
gd_hack: this driver introduces the ability to flip (vertical mirror), flop (horizontal mirror), or grayscale images.
/** * 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.
imagick_ext_hack: this driver introduces the ability to do a fully-featured rotation and an odd way of grayscaling.
/** * 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.
imagick_shell_hack: this driver introduces the ability to do a fully-featured rotation.
/** * 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.
There are still several options left for designing more drivers – there are still environments that need to be covered by an Asido driver. However, they are not as frequently used as the ones above. That’s why we are going to postpone them for now and not implement them. To see a detailed roadmap of what’s planned for Asido, check the Asido roadmap.