Embedding Loads of Photos (1 Viewer)

abbyfaust

New member
Local time
Yesterday, 16:47
Joined
Jan 26, 2007
Messages
8
I am wondering if it is possible to embed all of the photos that I have into my photo table automatically. I have the table set up with all of the data that needs to be there but I have over 1500 photos that need to be embedded and wanted to save myself some time and automate the process somehow. I already know that embedding these photos is going to make my database huge but that isn't an issue for this particular project.

As far as I can tell from this forum, the help and the Northwind database this isn't possible without manually going through every photo but I am pretty new to Access so thought I would throw the question out there.

Thanks
 
Last edited:

Moniker

VBA Pro
Local time
Yesterday, 19:47
Joined
Dec 21, 2006
Messages
1,567
Look at the FileSystem Object. You want all your photos in one folder on your computer. From there, you can cycle through each file (in this case, each photo) in the folder and perform tasks on them, like importing. You can also do this with the FileDialog object.
 

abbyfaust

New member
Local time
Yesterday, 16:47
Joined
Jan 26, 2007
Messages
8
Thanks,
I'm looking through it now...

Abby
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 19:47
Joined
Feb 28, 2001
Messages
27,138
Abby, let me add that if all the photos are in the right folder, it is possible (using the filesystem object) to locate the fully qualified file specs of each photo and add them to a record in your database, then just LINK to the photos. As long as they are always in the right folder, this is just as fast as embedding - and your database doesn't grow by leaps and bounds with the addition of just a couple of photos. When I take my vacation pix onto a digital medium and import them, I have a little routine that looks for the files, uses a DLookup to see if the file is new, and if not, appends it to the list of pix. My form uses an OnCurrent to load the file name to an image object, to the .picture property. The only difference is that I'm not occupying DB address space for embedded pix.
 

abbyfaust

New member
Local time
Yesterday, 16:47
Joined
Jan 26, 2007
Messages
8
That sounds good too. I kind of am stuck embedding them but thanks for writing. I need all the help I can get.

Abby
 

freakazeud

AWF VIP
Local time
Yesterday, 21:47
Joined
Sep 10, 2005
Messages
221
re:

Hi,
it is not advised to embed images within an Access application in all versions prior to the new 2007 edition. Access has a known bloating issue that will make you run into problems with the 2GB file size limit. As mentioned before just link to the files with a text datatype table field which holds the relative or absolute string path to the images (relative would be better...make the folder a subfolder of the application directory).
Access 2007 handles this much nicer with the new attachment data type which lets you add one or multiple attachments per record without the negative bloating effect.
HTH
Good luck
 

abbyfaust

New member
Local time
Yesterday, 16:47
Joined
Jan 26, 2007
Messages
8
Thanks for writing....unfortunately i am stuck embedding photos (it is what the client wants)...but if i ever need to make a database for my use or for something else at work i will definately take yours and everyone else's advice...

Thanks again!
Abby
 

ChrisO

Registered User.
Local time
Today, 10:47
Joined
Apr 30, 2003
Messages
3,202
Depending on the definition of bloat, and just why the customer wants them embedded, there may be a method.

For example… bloat:
1500 JPEG images @ 20,00 bytes per image = 30,000,000 bytes total.
(Not too big for Access or hard drives.)

There is no bloat in that calculation and I doubt if A2007 will improve on it unless they try to use compression which, technically speaking, is not good practice on already compressed image files.

Regards,
Chris.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 19:47
Joined
Feb 28, 2001
Messages
27,138
Abby, if your client wants this, you have a responsibility of sorts to tell him/her "ARE YOU NUTS, YOU WHACKO POINTY-HAIRED MANAGER?"

Or, if you think tact is more important, .... ;)

As a consultant, you have the responsibility to do what your customer wants. BUT you also have the responsibility to look out for your customer's mistaken ideas that have negative effects on their desired end goal. You should calmly, clearly explain that embedding an object in an Access DB is strictly disadvantageous and even perhaps prohibitive in the long run. You see, in order to build a database with a lot of embedded, hi-res pictures, you need the database itself to be big enough to hold all those pix - but you ALSO need swap space large enough to hold all those pix. If you run out of swap space, you will be unable to open the DB. Linking the pix makes the DB so much smaller that you will hardly ever run into the swap-space problem.
 

Anthony George

Registered User.
Local time
Today, 01:47
Joined
May 28, 2004
Messages
105
Very simple example without embedding

This sample database uses:

1 Table with 1 Field

1 Form with 1 text box linked to the field in the table and 1 image frame

The folder in the zip file is called images and contains both the database and 6 pictures.

The folder path should be C:\images

I know it is a linked system and not an embedded one, but I wanted to show you just how easy it is.

Regards

Tony

View attachment images.zip

PS The only code in it is:

Private Sub Form_Current()
Me![imagepath].SetFocus
Me![imageframe].Picture = Me![imagepath].Text

End Sub
 

galanthus

New member
Local time
Yesterday, 17:47
Joined
Feb 7, 2007
Messages
6
Well I know I'm a pain but I've really tried with this. In the link you sent me I can't see any flags on the form. Also when I make my picture frame on the form, it disappears when I go back to form view. I guess VB is beyond me.

I noticed on the trial of Access2007 there is a sample database for students. For each student a picture is added using the new attachment feature. I would have thought this would be potentially a lot of pictures. Any thoughts??

Its just I've created quite a nice little database and the pictures are the only thing causing problems.



Regards Sue
 

Anthony George

Registered User.
Local time
Today, 01:47
Joined
May 28, 2004
Messages
105
Hi Sue

Hi Sue

Sue I will create you a blow by blow account on how to do this but it may not be finished this evening.

Regards

Tony
 

abbyfaust

New member
Local time
Yesterday, 16:47
Joined
Jan 26, 2007
Messages
8
Just wanted to update anyone who helped me with my photo questions...
I embedded 2000 photos and am having no problems with Access....the database isnt even 1 GB.

anyway, thanks for helping me to anyone who has helped me to learn everything I now know about Access.

Abby
 

galanthus

New member
Local time
Yesterday, 17:47
Joined
Feb 7, 2007
Messages
6
Just to let those who helped know, I've finally got the hang of it!!!!!!!!!!!!!

Many Thanks Sue
 

neileg

AWF VIP
Local time
Today, 01:47
Joined
Dec 4, 2002
Messages
5,975
Please that you're pleased. Just so you know, Access will let you do all sorts of things that are just plain wrong in terms of good design. Even the wizards can generate code that is obsolete.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 19:47
Joined
Feb 28, 2001
Messages
27,138
Yeah, Neil's got that right. But even though the wizards are as dumb as a box of rocks, they are still your friends if they help quickly build the scaffolding that you need to flesh out your DB. After all, it isn't like you have to keep EVERYTHING they build once you are up and running...
 

Alikon

New member
Local time
Yesterday, 17:47
Joined
Oct 6, 2009
Messages
1
Re: Very simple example without embedding

This sample database uses:

1 Table with 1 Field

1 Form with 1 text box linked to the field in the table and 1 image frame

The folder in the zip file is called images and contains both the database and 6 pictures.

The folder path should be C:\images

I know it is a linked system and not an embedded one, but I wanted to show you just how easy it is.

Regards

Tony

View attachment 16342

PS The only code in it is:

Private Sub Form_Current()
Me![imagepath].SetFocus
Me![imageframe].Picture = Me![imagepath].Text

End Sub

This links locally but i cant for the life of me no matter what i try get it to link relatively.

So instead of putting "C:\images\AUSTRALIA.wmf" I would have the database and folder "images" on the same plane. Meaning inside the table it would read "\images\AUSTRALIA.wmf" and pull from the folder "images"

Any ideas anyone?
 

Simon_MT

Registered User.
Local time
Today, 01:47
Joined
Feb 26, 2007
Messages
2,177
Abby,

Take from some-one that had a database with 16,500, you do not embed images ever. Tell your client that for a start an image is a series of binary code that represent colours. My database is 100MB with 650MB of images. The images are only accessed when they are required. Generally on a screen you are dealing with about 12 images and on a report up to 100 images.

If these images are stored on a database, access has to search through 750MB of "data" just to get to the information. That is inefficient to say the least. If not images are required it still has to deal with 750MB rather than 100MB.

I have scripts to handle images referentially which I'm more than happy to provide.

Simon
 

ChrisO

Registered User.
Local time
Today, 10:47
Joined
Apr 30, 2003
Messages
3,202
G’day Alikon.

Your database should be split into a front end and back end.
You can then place all the images relative to the BE file so that you don’t have to maintain images on all FE machines.

The path from the FE machines to the images can be obtained from the MSysObjects table with: -
Code:
= DLookup("Database", "MSysObjects", "Name = '" & strTableName & "' And Type = 6")

Where strTableName is the name of the linked table containing "\images\AUSTRALIA.wmf"

You then concatenate the image sub directory and name to the result of the DLookup.

Hope that helps.

Regards,
Chris.
 

rotabug

New member
Local time
Today, 12:47
Joined
Mar 3, 2010
Messages
7
Hi Guys,
first of all if i need to create a new thread or post (sorry bout that)
second thanks for making this access stuff a little easier for me :)

My issue is this: My boss has asked me to create a maintenance database for our school (we're in hotel management) so we have accomodation rooms etc. now my issue is i have now figured out (thanks to your help) how to get these images in, but.... (theres always a but) he wants to be able to click on the image (say where the light is) to represent the light being broken and needing to be fixed, the maintenance guy fixes it and clicks it again to say its fixed.

there is approx 140 accomodation rooms in atleast 17 different layouts, not to mention kitchens lecture classrooms etc etc....

is this at all possible?? :confused:

Many many Thanks
Ross.
 

Users who are viewing this thread

Top Bottom