What a nightmare

By MA Developer

Well it has been a difficult time lately. With heavy rain sweeping the country I have been faced with pumping flood waters from around the house twice in a week. Fortunately we haven’t had the floods as bad as some in the country. The house wasn’t flooded but the damp course was breached which could have led to further problems. Once was bad enough but twice in a week took a lot out of me. Now I need to improve the drainage to ensure that it doesn’t happen again.

On the programming front I have managed to make some progress.  I’m currently working on the internals of the program with caching the data for display. Which led me to an issue with images. I am displaying a small thumbnail picture but don’t want to distribute several hundreds of images either with the program or as an update. The answer is to embed the images in a database. Though Access will store images there is no native image format for a field to support it. Access does allow you to create an OLE Object for the image and then relies upon in built routines or plugins to display the image. This works fine within Access but as I’m reading the db from an external program there is an issue as Access wraps an OLE header to the image making it unusable.

 After some digging I managed to find some sources as to how to get around the problem. The trick is to write the image to the database from the external program and let the external program handle the field type as long binary data. Whilst the image is unusable within Access this doesn’t matter to me as I only want to store the image and let my program reference it.

 I created a utility that allows me to upload images into the database and it will read them back aswell to verify that they are usable. The database that was created stores about 1000 images and is currently about 15MB in size. This is a down side to storing images in a database as it is bloated out. But when comparing the database to the source directories I noticed that this was only a couple of megs larger so I feel it is an acceptable trade off. I can now distribute a database of images instead of several hundreds of individual files. It was interesting to note that using a zip file not only added more complication in extracting the image but there was little saving in disk space.

Now I need to incorporate the database read routine into Modellers Assistant so that the image is read from the database rather than from the directory. Trials on update downloads showed that the database takes about 1 and half minutes to download via FTP which again I feel is acceptable.

Leave a Reply