Storing Images (1 Viewer)

Privateer

Registered User.
Local time
Today, 04:03
Joined
Aug 16, 2011
Messages
193
I have a Library database that has images of book covers stored in the books table as OLE Objects and bound to an object frame on the form. There are also images of authors in the authors' table. I am the only one using the database, so it is not split and is currently 1.7 GB in size, which is close to the limit. The storage of the images as bitmaps is obviously causing the bloat. I have saved a few images to the local drive and using the path and file name, gotten the picture to display in an image control. I think this is the way to go, but there are some questions that need to be answered first.
When I look up a book at, say, Barnes & Noble, I right click on the image, copy it, and paste it into the OLE Object. Done. With this new procedure, how do I get the image saved to a file with the least amount of trouble? I am using the author's last name and the book title for the file name, but I don't know how to identify the original image format as a JPEG or PNG or WebP. If I paste it anywhere in Access, it gets converted to a BMP and gets huge. I would like to be able to paste it into the form and use code to save it as a file, but I don't know what type of object or data type to use on the form to display the image, nor do I know if I can just tack a .jpg to the end of the file name and hope it saves is in that format. Is there some form of conversion that has to happen and is there code out there to do that already?
The other issue is that I have about 600 book covers and 50 authors already in the tables as big fat bitmaps and extracting them to a file, with some extension is another issue. For my test examples, I copied the image from the form to Paint and manually saved it as a JPEG to a sub folder under the database. Can this be automated with code allowing me to bypass the Paint application and just loop through all the images and save them as files?
I think saving the image as a file is the way to go because attachments and BLOBs still keep the image in the database, so bloat could still be an issue. Does anyone have any thoughts on the preferred method to store images that are accessible to Access? Has anyone done it already and can you share your insights? This storage of images should not be so hard. As always, any help would be appreciated. Thanks.
 

GPGeorge

Grover Park George
Local time
Today, 01:03
Joined
Nov 25, 2004
Messages
1,867
You are right. Moving the image files out of the accdb into a folder is an extremely important step. It's safe to say that it is the preferred method.

I have not done a conversion of image files from attachment fields to a folder, but I'm sure I've seen procedures here and other forums to do that. Search the archives; I'm sure you'll find one or more examples.

Saving image files to a network folder is pretty straightforward, assuming you are seeing them on a webpage.

I have a series of YouTube videos for PowerApps image files, but that's different environment and has little overlap.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:03
Joined
Oct 29, 2018
Messages
21,473
Saving attachments or blobs to physical files should be doable. I believe there is a property in the field that identifies the file type for you, so you don't have to guess or even convert them.
 

Users who are viewing this thread

Top Bottom