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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display .jpg images from dbf on form

Status
Not open for further replies.

Newtonm

Programmer
Nov 8, 2001
39
0
0
CA
I'm sure its easy to do but I cant find the correct combination. We are working on a fairly large table of music on CD information which needs to be modified to include images of the cover art. We can obatin these images in .jpg format but ae uncertain how to link them to each record. Should we be using a Memo, Memo Binary or General field.
Then how do we ensure that the image is shown when the user finds the correct item.

I am presently on an extended UK vacation and using the time to finally get a firm handle on VFP. Currently using 6.0

email address is temporarily changed to fourletr@nildram.co.uk



Richard Myers
Four Letter Software Inc.
 
Richard

Welcome to the UK.

Most developers regard best practice for the storage and retrieval of images to be path\filename.ext in a field in a table and the files in suitable folders.

As you scroll through the records you can set the .Picture property of an .Image control to be

THISFORM.Image1.Picture = ALLT(MYTABLE.filename)


Avoid general fields like the plague - if you do a keyword search you will find out why.

FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Newtonm

Most likely the best recommendation you can get is, do not use any other field type than textfield (that would hold the path of where you picture is stored on the hard disk). Putting a jpeg picture in a general field works (but the table would grow too quickly) if you have very few pictures , but that doesn't seem to be your situation, so store your picture on the hard drive somewhere and in your textfield, store the path to it.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Many thanks to ChrisR and MikeG, that's exactly what I was looking for.

MikeL: It's suprising what 3 months away from one's clients in our seaside flat (Worthing SX) can do for one's concentration. Yes of course its work but no pressure!!! Makes all the difference.

Regards from Sunny Worthing UK (Yes it is shining!!)



Richard Myers
Four Letter Software Inc.
 
Hmmm!!!
Having added an image control to my form I cannot see how or where you might add line of code that Chris Chamberlain suggested viz THISFORM.Image1.Picture=ALLT(MYTABLE.filename)
The Picture property expects only a line of text or name of a graphic file. since this name changes each time one moves through the table one obiously cannot hard code a specific graphic there. There is no place to add said code if one goes into the code area of Image1.

Now I'm totally confused, sorry to be such a wimp but this operation is key to my whole application.

Anybody ???


Richard Myers
Four Letter Software Inc.
 
You would put that line:
THISFORM.Image1.Picture=ALLT(MYTABLE.filename)
...right after the code on your form that would move the record pointer in MYTABLE (SKIP or SEEK or GOTO or whatever).

The Image control senses when the .Picture property changes, and reloads the file the new value points to.
 
Richard,
Here is how I put pictures on a form:

In the table that holds the standard information (say cdinfo.dbf) which would have data like name,artist,date,recording label..... add a character field (say cdpic) long enough to hold the path to the image ('c\data\cd\images\eagles4.jpg' for example).

Whatever method you use to browse or lookup the data, simply place 'thisform.image1.picture=cdpic' in the command or code where you update other controls on the form.

Scott
 
My thanks to all of you that replied to my plea for assistance. I'm pleased to say that the problem is solved and working perfectly.

Regards


Richard Myers
Four Letter Software Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top