Question [Help]Un-embedding images in a database.

eviscerator

New member
Local time
Today, 18:22
Joined
Apr 8, 2009
Messages
7
Hello, I'm a new user to access and I have a poor knowdledge in scripting with visual basic. After many searches I managed to find this awesome forum where in the future I could learn a lot of stuff about creating "solid" Access Databases.

Due to the fact I'm in the need of a database of the objects I buy/sell in my shop I started creating my own database with Access 2007. Unfortunately the templates available with Access 2007 couldn't provide me much help, so I had to build a database from scratch. I've had a few hard weeks but finally I'm starting to understand many of the things that run an Access Databases.

Unfortunately I came up with a problem managing images in my database. As I've figured out, and read amongst various threads here, embedding images in a database with Access isn't a good thing (Especially if the database needs to hold 1000+ photos).

I searched the forums and found that many users asked already for this but due to my knowdledge with scripting (and the fact of being still a new user with Access2007) I can't figure out a way to implement un-embed images in my database.

My database is almost finished, I need to polish the masks a bit as well as a few other stuff but I still have to deal with this problem with images.

I wanted to ask if anyone here was kind enough to provide me some help by converting my "embed image fields" into unembed ones.

I'll explain here how the database manages images:

Table Acquisto keeps records of the object I sell and has an Attachment field called "Immagine". This field stores the embed image files.

The mask called "mask_aggiungi" add new records to the Table Acquisto and has a dedicated box for the Immagine attachment field. After adding the attachment file, it displays the picture uploaded in the database.

The following masks and reports read and edit the Immagine attachment field:

mask_visualizzamod
repGaranzia

Basically the work that has to be done is to delete the Immagine attachment field and replace it with a normal text field (that could still be named Immagine) that will include the Image URL of each record. A script (and here's where I am absolutely out of knowdledge and need help) reads this new Immagine text field and displays in the Immagine boxes a "preview" of the image URL I've given to each record.

Also one last thing. In order to implement this it would be good for me to create a folder which would store my image files and that would always be the same (and never change it's path). Is it possible to only insert the Image name (and extension) given the fact that the path (and folder) would never change?

Example:

Immagine field:
filename.jpg (the database already knows the folders where to look after the file by default ex. c:\documents\images\)

instead of

Immagine field:
c:\documents\images\filename.jpg


Anyone could help me do this? I'm attaching to this post the database I've created.

Thanks a lot in advance,

Best Regards

Filippo
 

Attachments

yes it's very possible. i do it myself. just a few questions though - is this a split database, or a database on a server? coz mine's just a simple mdb on a local drive, so it works just fine in my situation... but my initial research lead me to belive my solution was not suitable for server-based dbs (and never had a db split before, so don't know any side-effects there).

have a look at this thread, which was my own evolution of such an image management system. there won't be everything you need there, but you can also search these forums for "relative images" and that'll bring up quite a lot of information.

http://www.access-programmers.co.uk/forums/showthread.php?t=155277
 
Here is a link that does the whole job Embed and Publish take a look at step 3 this will show you how to do it. BTW this was for pre Access 2007 not tested in 2007.

Sample Databases
 
Ok that's perfect, thanks for the hints guys, I fixed the database and images are displaying just fine.

Thanks a lot.
 
Oh well basically I just had a look at the code and how the database you linked was set up.

All I did was to remove the Attachment column from the table Acquisto and later I have added 2 more columns: "ImgLink" and "FolderLink". I applied a default value to Folderlink and blocked it, then I have simply put the ImgLink field into a mask. After that I added an Image field to the mask/reports I wanted and added as field origin =[FolderLink]&[ImgLink]. And the work is done. To be honest I feel pretty dumb, I could've come to that easily and at first when I wrote this thread I thought this way to have it was "too easy to work" hehe.
 
don't forget a null handler (which be used to display a default placeholder image if there is no custom image) - nulls can really frustrate your code and yourself.
 

Users who are viewing this thread

Back
Top Bottom