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

Picturs in Fox 2.6

Status
Not open for further replies.

blumash

Programmer
Oct 2, 2003
50
HU
How can I put or conect a picture to a record in a DBF file , for example , an employs file need to add a small picture for each worker in the company.

Thank's
 
Hi Blumash,
Your code would be something like this:
Code:
create table temp (name C(10), piccy G)
insert into temp (name) Values ("Fred Smith")
cFile=getfile() 
&& Choose a picture. I think FPW2.6 will handle 
&& BMPs & TIFs fine but not JPG.
append general piccy from (cFile)
ie:
Create a General field
Get the image from a file by append general (fieldname) from (filename)
See HELP APPEND GENERAL for more syntax.

Use the general field as the contents of a picture on a FPW2 form; or view it as you'd view a memo field, by browsing and pressing Ctrl-PgUp
 
Blumash

Chris is correct in his post however it is worth noting that there were issues with embedding pictures and we found in our app (which was network implemented) more appropriate to ensure the picture file was saved programatically with the data e.g. in a photos subfolder and then use the append general (fieldname) from (path\filename) with the LINK clause.


Bob Palmer
The most common solution is H2O!
 
While append general will work, you must have the same application as you are using to append the picture, running and associated, on any other workstation which will try to access it.
In other words, don't try to append using MS Paint to append the picture and expect Paint Shop to open it on the other workstations. (Or vice-versa).
Not to mention you will have a problem with file bloat using a general field.

I've always found it better to just use the file name (and path if needed) in a character field. You can always use that reference to redisplay the picture later.
For example:

Code:
REPLACE MyTable.FileName WITH "C:\MyApp\Pictures\Employee1.BMP"

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
I m trieng to run the folowing code , I would like to add a picture to each record of product file. All the pictures r there but when the program cames to the "append" line code I recive an error massage.

Code:
select product
go top
do while ! eof()
prd=product.prdcat
if file('d:\avigdor\&prd..bmp')
append general picture from &prd..bmp
endif
skip 1
enddo

I don't realy know what is the problem , maybe somebody can advice me what do do/fix in order to run it properly.

Thank's
 
maybe you want to rewrite it this way:
Code:
select product
go top
scan
   prd=product.prdcat
   [COLOR=blue]if file('d:\avigdor\' + alltrim(prd) + '.bmp')
      append general picture from ('d:\avigdor\' + alltrim(prd) + '.bmp')[/color]
   endif
endscan

hope this helps. peace! [peace]

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
Thank's torturedmind , it's working , I just recived a error massage in some pictures
Code:
Error Creating OLE Object
all the pictures r same size and BMP files , why in some pictures I received error massage & in others not.

Thank's again
 
my question regarding this post is how to append the same picture to a memory varible in a screen directly without having it in a general field of a table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top