Sunday, April 01, 2007

Extracting images out of General fields

I think most of you know that sticking images in VFP General fields is considered a bad practice. I also know many VFP developers were lulled into the cool idea of storing images and other files into General fields, myself included back in the mid-90's. Then you quickly realize you cannot get the images out of the memo files without some great pain.

I have been lucky over the years because I have not run into any requirements or projects needing to work with General fields. That is until recently. A new project I am working on has some BMPs stored in VFP DBFs and the developer I am working with knows he made a mistake and is ready to correct it as we rewrite his vertical market application in a short 5-6 week period. I have outsourced the conversion part of the app to one of my subcontractors. I know I had read somewhere how you can extract the image data, but could not recall where. Since I did not have time to look it up I delegated it to the person doing the conversion and the answer came quickly.

How to export pictures from General fields by using the ReportListener base class in Visual FoxPro 9


In this Microsoft KnowledgeBase (KB) article Trevor Hancock (a wizard in support for VFP) details and provides code to extract the images using the HTML Report Listener. Pure "Freaking Magic"!

This one KB article saved our project days of development. Thanks Trevor. I know you work in a role on the Fox Team that is probably one of the more difficult (always being handed something allegedly broken) and probably one of the more thankless roles. I have observed Trevor in action and he is one of the best problem solvers I have had the pleasure of working with in my years of beta testing. Thanks to the architects of the powerful ReportListener that makes mince meat of the long time problem of extracting images from the General fields. Very nice piece of work!

Labels: , ,