Foxpro report showing images

Hi gang, I have a table where one of the fields holds a path to an image file.  I wish to make a report showing each record and the actual image stated in the field where the path is kept.  I do not want to use the general field to actually store the image as it slows down my application.  Foxpro 2,6 and VFP7.

Thanks guys
DelboyAsked:
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.

slink9Commented:
Here is the accepted answer in another question.

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)
Endif
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)
Endif

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
DelboyAuthor Commented:
Many thanks..  Derek
ah7386Commented:
On your report, add the OLE Picture/Active X control and set the FILE property to your field name that contains the path to the file.  DONT use the FIELD property as this is only for General fields.

Regards

AH
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
FoxPro

From novice to tech pro — start learning today.