Reflection on CF8's Image Tooling

I was really hoping for (though not really expecting) a nice simple solution to centering text on an image to show up as a result of the Wednesday Contest. Sadly, that wasn't the case. As you might guess, the contest was based on a real world use case that I had: gracefully handling the image tooling's inability to generate thumbnails of certain images.  The usual culprit seems to be color profile issues (which cause fatal errors), but I also get a number of thumbnails that come out with horribly screwed up colors (not actual negatives, but close). I should mention that I'm not doing anything special to create the thumbnails, just resizing the image to within certain bounds (usually 150×150 or 100×100).

I hadn't had the resizing problem with my JAI-based solution (which piggy-backed on the Lite/DevNet edition of Alagad Image Component), so I'd never had occasion to drop in error handling until switching to CF8's built-in toolkit. I didn't want to spend much time on it, just wanted it to not throw errors and create unbroken images, so I picked a pretty simple (I thought) task. This was the task I posed as the Wednesday Contest, though my implementation actually uses three lines instead of one (for "Error Generating Thumbnail"). I'd originally wanted to use 12pt bold instead of the default (10pt plain), but after seeing the implementation cost of using a non-default font (default font implementation vs. custom font implementation), I bailed on that and used the default.

I'd be lying if I said I wasn't disappointed. Centering text seems like a fairly basic task, but it's far from simple to do. I went back to the docs several times sure that I'd missed something, but unless I'm an idiot, there's nothing there.

2 responses to “Reflection on CF8's Image Tooling”

  1. Ben Nadel


    Based on some stuff I learned from your solution, I have a cool little function going. I will run it by you soon.

  2. Ben Nadel

    I will stop leaving so many comments, but I just wanted to show you that your Extra Credit solution inspired me:

    Thanks Barney!