Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to store images? 1

Status
Not open for further replies.

wtotten

IS-IT--Management
Apr 10, 2002
181
US
I have an application that tracks animals for a Humane Society. There are 10-20,000 animals in the system. They want to be able to take pictures of the animals and add them to the tables.

Do I store the image in a table, or do I store a link to the file's location on the disk? I have never stored anything like this in any of my tables. They will want to view the image on the screen and on some reports the image prints as well.

I am asking for anyone to share their experience with me in having done this.

Bill
 
Hi Bill,

Do I store the image in a table, or do I store a link to the file's location on the disk?

Both approaches would work. But by far the better method is to use the table to store the file's location, and keep the actual pictures in separate files on your disk. Storing pictures in a table is possible, but it's very inefficient, leading to bloated files and other difficulties.

In fact, if you use a dedicated directory to hold the pictures, and if the images' filenames follow a predictable pattern, you don't need to store anything in the table. For example, if the filename is the same as the Animal ID (or whatever you call the main identifier for the animal), then you can derive the full path and file name programmatically.

To display the picture, use the Image control. Set its Picture property to the path/filename. And that's all there is to it.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you Mike. that's exactly what I was looking for and the file naming idea is perfect!

Bill
 
One small addition. Since you have large number of files(images). Break them into chuncks of ~1000 files per directory. When accessing, it will locate faster. For example, all animals starting with letter 'a' put them under images\a, starting with 'b' store the images under images\b, etc.


Nasib
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top