how to download images stored in base LongVarBinary?

I have Images stored in LibreOffice Base in a table field LongVarBinary. I created a form where I can insert and delete images. Now I am keeping images there to use later. I want to add a download button to download the selected stored image. I searched online and I have yet to find anything useful on how to do that. Can Anyone help? Using default DB.

I know I can link the image rather than storing it in the DB but I want to keep it in the DB to make it easier for others. Is there a way to download the image?

I created a Form Image Control where I can insert and remove image. When an image row is selected in the form, The image is viewed in “Image Control” field. I need to be able to download the image as well. I can’t find a way on that field to download nor to create a download button for it.


It is not clear as to what is meant by the selected stored image. If you want to use these images somewhere else, then that somewhere else needs access to you database. Data is only accessed through the database and that means needing a database connection or code to access Base. You most likely would need to use something other than an embedded database.

As for the default DB, this is a bad idea. The default Embedded HSQLDB is prone to problems when it comes to large amounts of data and images certainly fall into this category. Each time the Base file is opened or closed the files are zipped/unzipped from the .odb causing a potential loss of data. Have see failure with as few as 5-7 images in a file.

You would be much better off using Firebird (currently enabled with experimental features but soon to be the new default) which does not have this data loss problem. Other external databases also work - PostgreSQL, MySQL, etc.

I added a comment with more description about the use in form. Thanks for the heads up about the DB type. Do you know of a way to convert existing schema and forms to use new database?

@theone814 Sorry, but the question remains the same. Download it to where? Seems you already have table & fields established where the image is one of them therefore the image is already in the DB. So please explain what you mean by download it.

As for different DB, it really depends upon which DB you want to change to. There are many and different reasons to use one over another.

I suppose that OP wants to simply save the image from the DB to a separate image file using that button, which was called “download” :slight_smile:

Thanks Mike - That is what I kind of guessed myself.

@theone814 - For downloading to a directory you need to use a macro (basic code). There is a sample, with code, at the end of this post → Pictures in Base. It also refers to Pitonyak’s original .odb & his excellent book on macros.