This past week, at work, we decided to replace all code using the CFX_Image dll with Doug Hughes Alagad Image Component (AIC). The AIC is highly regarded in the ColdFusion community as one of the best image manipulation utilities available. That it's built in native ColdFusion code without any dependencies on server platform is but one of its strong points. It's also pretty darn robust and chock full of dozens of drawing, resizing, coloring, and other functions. I spent some time putting the AIC into place and have learned a few things about its use. Immediately obvious are some potential threading issues given how instance data is stored in the component. Because the component stores information about read images in the component itself, it's not advisable to create an instance of the CFC in the Application scope (at least, not without some extra work). This is both good and bad. Because it's expensive to create instances of the component it would be nice if you could store one instance in the Application scope and then call methods on that instance anywhere in your application. Without some extra work to serialize access to the component, the potential for two different users to read each others image data (and erroneously write images with that data) is real. Jared Rypka-Hauer, on the Team Macromedia list recommended creating a resource pool made up of several (perhaps hundreds) of instances of the CFC and then single-thread multiple calls to the resource pool via your own management code (perhaps another CFC). This would be fine in most cases but given how memory-intensive the AIC is you would certainly impact server resources.

For our purposes at work I chose to simply create an instance of the component in the variables scope each time I needed to use it. One of our back-end processes involves resizing upwards of 2,000 images at a time. Creating one instance of the AIC before the image processing loop and calling the various methods throughout the body of the loop worked really well. It took approximately 8 minutes (on a very low grade server) to read about 700 images and write 1,400 images. The whole process, as compared with the CFX_Image tag, was slightly slower but with greater functionality and system portability there's no doubt the Alagad Image Component comes out ahead.

Of all the image manipulation tags available I definitely recommend the Alagad Image Component. For $75.00 you won't find anything better.

Aaron West's Gravatar
About this post:

This entry was posted by Aaron West on October 30, 2005 at 9:30 PM. It was filed in the following categories: ColdFusion. It has been viewed 9031 times and has 0 comments.

0 Responses to A Quick Review of the Alagad Image Component