Extract images from dbf memo field
-
Wednesday, January 28, 2009 6:13 PM
I need to extract images from dbf memo field. I have 3 files (*.dbf; *.cdx and *.fpt) in the *.dbf file I have a memo field where are images (in the associated file *.fpt) and I need to extract these images to a physical file.
Thanks
All Replies
-
Thursday, January 29, 2009 9:42 AM
Hi,
You can do this with
STRTOFILE(YourMemoFieldName,"JPGFileName.JPG")
- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Tuesday, June 19, 2012 8:56 PM
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Friday, June 29, 2012 11:24 PM
-
Thursday, January 29, 2009 10:42 AM
select yourTable
scan
lcFileName = forcext( "Image" + transform(recno()), "bmp")
=strtoFile(yourTable.memoField, lcFileName)
endscan
- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Tuesday, June 19, 2012 8:56 PM
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Friday, June 29, 2012 11:24 PM
-
Thursday, January 29, 2009 12:28 PM
You already received info on extrating from Memo fields. I assume you are not using General fields. You should not use them. The best place to store is probably in a BLOB field.
Example:Create Table images (nID i,bImage blob)
local liBlob
* select a JPG:
liBlob = FileToStr(GetPict())
* we can save it in a table (even SQL Server supports it)
Insert into images (nID,bImage) values (1,liBlob)
...
* later, we retrieve the BLOB and save it back to a JPG:
StrToFile(liBlob, "c:\temp\myImage.jpg")- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Tuesday, June 19, 2012 8:55 PM
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Friday, June 29, 2012 11:25 PM
-
Thursday, January 29, 2009 12:33 PM
Could you make a more detailed snippet, because I have same difficult with FoxPro.
My dbf have de following structure :
field1 – type (string); length (1)
field2 – type (string); length (16)
field3 – type (string); length(2)
field4 – type (memo); length (10)
I want to extract the images stored in memo field to physical file with following format : field2.jpg
Thanks

