Store Pictures into TABLE ?

I have created a table named collection.dbf. I hope to store all my pictures into a field named IMAGES. What should I do with the table structure and in the form design?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ramromconsultant Commented:
For the table:
Create a General Field.
Use Append General to put a picture in the general field.

For the form, from article Q139184:

To display an image on a form from a general field, use an OLE Bound. Set the ControlSource property of the OLE Bound Control to the general field.

Just to let you know, there will be problems storing pictures in a general field, if you need to use the pictures in other apps (such as Crystal Reports, Word) later.

The recommended procedure is to store the file on disk somewhere, and just store the filename in the table.

ramromconsultant Commented:
and now you know the rest of the story...
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

If you don't want to use a general field you also can put the pictures in your table. You can store them within  a binary memo field.
APPEND MEMO ... stores a file to the table and COPY MEMO ... gets it.
Won't this make for a VERY large table?  This would not seem to be the best solution to store pictures in a table.  I like the idea of storing the location of the picture.  Of course, if the picture moves, that won't work very well.  Okay, so I am my best enemy in debating!
Storing pictures in a general field is the easiest, but also the most troublesome way. What basically happens is that the application that currently deals with this type of pictures is asked to load that picture as a document and that document is stored into the general field.

The disadvantages are that for one the application name is stored along with the picture. Only with that application the picture can be opened again. Also, VFP stores a preview of the image in the table. This preview is stored in uncompressed BMP format. That means, a huge JPG file that is less than 100 KB in size can suddenly grow to a 2.5 MEGAbyte FPT file. And the final disadvantage is that you can't easily copy a picture from a general field back into a file.

The most flexible approach is to have one field in the the table that stores the name and path of the image. If you move pictures around often, you can use a second table that stores all pathes and in the picture table only store the ID of that path. If the path changes, you only need to change one field in the path table.

To display such an image on a form, you need to put an Image control on the form and in the Refresh event of the form put:

Thisform.Image1.Picture = Table.cPicName

If pictures can move often or you want to move all pictures into a table, use a binary memo field. Add a property cImageFile to form and again an image control. Put the following code into the Refresh:

If File(Thisform.cImageFile)
   Erase (Thisform.cImageFile)
Thisform.cImageFile = Sys(3)
Copy Memo cImage to (Thisform.cImageFile)
Thisform.Image1.Picture = Thisform.cImageFile

In the QueryUnload event put:

If File(Thisform.cImageFile)
   Erase (Thisform.cImageFile)

If you are using the Image control you are limited to BMP files (in VFP 5) and to BMP, JPEG and GIF files in VFP 6. For other image formats you need to use a third party ActiveX control that can display images.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chan73Author Commented:
Answer accepted
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.