Extract images from dbf memo field



    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.

    Wednesday, January 28, 2009 6:13 PM


All replies

  • Hi,

    You can do this with


    Thursday, January 29, 2009 9:42 AM

    select yourTable


    lcFileName = forcext( "Image"  + transform(recno()), "bmp")

    =strtoFile(yourTable.memoField, lcFileName)




    Thursday, January 29, 2009 10:42 AM
  • 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.


    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")

    Thursday, January 29, 2009 12:28 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


    Thursday, January 29, 2009 12:33 PM