Page 1 of 1

Store / retrieve Images in MySQL Using Delphi and Zeos

Posted: 29.07.2008, 19:31
by mparak
Dear Friends,

In the past I was advised to link to images in their original file format and this has worked well so far. This however requires a network share to ba made available and as we are attempting to close all the security loopholes we would like to access images from within MySQL. Blob Fields maybe. The performance overhead is obvious but we are prepared to accept the limitations in favour of better security.

The MySQL forums give very round about methods of using streams to send vast amounts of data to store the simplest of images. Does anybody know of a simpler and more elegant solution?

Any help would be greatly appreciated.

Warmest Regards

M.
www.cad.co.za

Posted: 11.08.2008, 07:44
by mparak
Dear Friends,

After making many attempts at getting advice on the "how" from both MySQL forums and Zeos forums, when I had almost given up hope of using the Blob field to store thumbnail images. I found a way that is a little convoluted but entirely successful.

Clearly one of the major problems is that the image needs to be resized first to be able to fit within a mediumblob field. Then converted from jpg to bmp. From there on it all fell into place and the solution is functional. (not quite elegant, but functional). I am working on making it elegant before posting.

Warmest Regards

M Parak
www.cad.co.za
Durban

Posted: 11.08.2008, 14:42
by mparak
Even though the images that I am inserting are minute (320X240) I find that a simple select statement returning a single record (out of 10 records on the test table) takes much too long to respond. (over the internet with remote server).

I tried this from the MySQL command line and found that the delay was exactly the same. Local LAN based queries appeared fine. The fact that MySQL command line tool had the same limitations leads me to believe that this is a MySQL issue, not a Zeos one. Just thought I would mention this, to see if anyone else has found some way around this sluggish select.

Regards

M Parak
www.cad.co.za