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

general fied "BMP and JPEG images"

Status
Not open for further replies.

jebo100

Technical User
May 11, 2007
52
PH
i am creating an employee dbf with a general field (field name:'idpic')and Appended some images from files.
"append general idpic from x:\images\picture001.jpg"

but when iput the general field in my form.
[problem?]
it wont show the image i appended, instead it only shows the file name "picture001.jpg"

if i append a BMP file to the field,it shows the picture on my form. but it goes pixelized when i strech the image.


[question]
is this normal?
i mean, does general field only supports BMP images?
***************************************************

i am creating this for my employee database and for printing an identification card for emplyees.


thanks!
 
Hi

The general field does support most file formats, but it isn't very good at it. For one thing, the "picture001.jpg" is generally a file association problem - VFP is confused as to which application it should use to display the general field contents.

Most people, on here, would recommend that you don't store the image data in a general field anyway. They are fiddly and subject to bloat. There is also no 'elegant' way to extract the contents back to a file - it is possible, but seems clumsy.

So, I would suggest that you either store the files in their native formats on a visible share/HD and then use a RELATIVE pointer to the file name i.e. don't include the full share and path in the field you hold the pointer in, just store the relative bit and file name:

Code:
if your file is stored here:
F:\ADMIN\PERSONNEL\DATABASE\IMAGES\PICTURE001.JPG

then store just:
IMAGES\PICTURE001.JPG

In a data table and hold:
F:\ADMIN\PERSONNEL\DATABASE\

as a workstation based prefix.

This will allow different users to pick up the share/file from different roots, and allow you to move the data to a different drive very easily.

Also watch out for 'silly' file names, people will do things like appending spaces to the end of the extension or before the last period!

The second suggestion, if you must use a table to hold the images, is to use a binary memo field instead. so long as you know the file type (by the extension) you can use something like this to get the image into the table:

Code:
select myTable
append blank
replace myFileName with "PICTURE001.JPG"
replace myBinary with FileToStr("C:\MyFolder\Picture001.jpg")

and to retrieve the image later:
Code:
select myTable
locate for myFileName="PICTURE001.JPG"
if found()
  StrToFile(myTable.myBinary,"C:\TEMP\PICTURE001.JPG")
endif

Good luck


Regards

Griff
Keep [Smile]ing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top