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!

Reading Jpeg Picture to a Database 2

Status
Not open for further replies.

barno

Programmer
May 27, 2002
10
0
0
Im running & maintaining a database of pictures for customers & their details in Visual Foxpro 6.0 .My problem is that when i use the GENERAL Data type the .JPG is always saved as an Icon not as the picture in the database.Its only when i save the picture as a .BMP that the picture is saved & displayed well. How can i maintain .JPG pictures in my database?
 
Barno,

Andrew is right, the conventional wisdom is to store the images in native format - using the database only to hold text based pointers to them.

If you really want to store them in a table, I can see this being usefull where they are perhaps small (ID photos for example) or limited in number (a company logo perhaps). In these cases use the filetostr() function to read the value off disk and store in a memo field instead. The general field is pants.

Code:
replace myMemo with filetostr("c:\apps\myJpegFile.jpg")

HTH

Regards

Griff
Keep [Smile]ing
 
Hmmm. VERY good call Andrew - overlooked that binary point!

Regards

Griff
Keep [Smile]ing
 
I agree. Put the pictures in a pictures directory then us a character field in a table to hold the path and filename of each picture.
The table can associate a picture or pictures to a part number, person, etc.
The picture can be easily displayed on a form or on a report.

Scott
 
I've been messing around with this using for example thisform.Image1.picture=ALLT(table.field) and the field has the pathname to the folder with the images. I can't seem to get this to work with either .jpeg's or bmp's any idea why?

I can get images to appear on a form but I can't seem to get the image to refresh based on another field. Ex. Select item # picture of item appears on form.

Any suggestions why this might not work? As always many thanks in advance!!!!
 
Kerbouchard,

Try something like this in the refresh of the image1 control.
Code:
ThisForm.image1.picture=ALLTRIM(table.field)
DODEFAULT

What's happening is that when you store the value to the picture property it doesn't see it as ALLTRIM(table.field) what it sees is "C:\picture directory\image.bmp" so you must reassign the picture property everytime the table pointer moves. I hope I'm making sense
 
That doesn't seem to want to work either.
A suggestion I got from another website was this:
Public fileloc
fileloc="maptoimagehere.bmp"
thisform.Image1.picture = ALLTRIM(fileloc)
I can manipulate this so that it works for me but it will always be one image on there.
Is there anyway to set the fileloc variable to:
fileloc="s:\Images\(thisform.txtitem).bmp" the name of the bitmap is always the name of the item.
Any suggestions? Thanks!
 
Code:
fileloc = "S:\Images\"  + ALLTRIM(thisform.txtitem) + ".bmp"[code]

This should work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top