locked
Pick Picture through software RRS feed

  • Question

  • Hi all

    I want to develop the employee salary software. and want to take the each employee picture through software and save in the general field is it possible

    thanks

    jasvee

    Sunday, June 6, 2010 9:11 AM

Answers

  • Yes there is problem in storing general field and you already experienced one of the problems seeing only filename. My suggestions: 1) Preferably use SQL server 2008 and later. Express versions are free and with SQL Server 2008 R2 express you have 10Gb database limit (a database means all the tables, indexes, stored procs ... Limit is not per table) which is enough for many VFP based applications. In SQL Server 2008 there is FILESTREAM attribute. Using that you can store your pictures in database yet they are stored separately on disk. Those files do not count against database 10Gb limit. Storage and retrieval are under SQL server's control because to you it is just another field in the table. You wouldn't have problems if that is a remote location where you have access to database (with VFP and storing paths only you may guess the problems). OTOH you may not want to use SQL server with cursoradapter for your particular reasons. 2) Storing just the paths is general suggestion but that has problems as well (security at least). You may still like to store in a table. Then create a separate table just for those pictures with one primary key ID field + one BLOB. Table has 1-to-1 relation with your employee table then. To show picture, you use an Image control and set its PictureVal property to your picTable.Picture. If you are using VFP SP1 (like me) and working under win7 64 then pictureval has a bug (corrected in SP2 as they say). To workaround I created a simple class:

    define class ImageControl as Image
    Procedure PictureVal_Assign
    Lparameters vNewVal
    If Val(Os(3)) < 6
     This.PictureVal = m.vNewVal
    Else
     If !Empty(This.Tag)
      Erase (This.Tag)
     Endif
     This.Tag = Forcepath(Sys(2015)+'.pic',Sys(2023))
     Strtofile(m.vNewVal,This.Tag)
     This.Picture = This.Tag
    Endif
    endproc
    
    Procedure Destroy
    If !Empty(This.Tag)
      Erase (This.Tag)
    Endif
    endproc
    enddefine
    
    
    • Proposed as answer by Naomi N Sunday, June 6, 2010 5:29 PM
    • Marked as answer by Liliane Teng Friday, June 11, 2010 9:07 AM
    Sunday, June 6, 2010 12:56 PM
  • There are many ways. For example in help check CursorAdapter.
    • Marked as answer by Liliane Teng Friday, June 11, 2010 9:07 AM
    Sunday, June 6, 2010 2:06 PM

All replies

  • Yes it is possible, but saving them in a general field is not recommended, saving them to your hard disk and saving the path and fiel name in a text field is more recommended.

    I developped something recently for a client that had a similar requirement. We used a Logitec 9000 web cam, and we acuired an OCX that can control every aspect of the camera, including zoom and panning and snapshot taking. It generates a BMP file that you can save anyway you want.

    • Proposed as answer by Michel G Sunday, June 6, 2010 10:24 AM
    • Unproposed as answer by jasvee Sunday, June 6, 2010 12:52 PM
    Sunday, June 6, 2010 10:24 AM
  • Hi Michel

    Is there are any problem for storing picture in general filed. This for I am saying if we saving picture in hdd there is problem for mixed up. So that I decide to save in general filed.

    append general photo from getfile("bmp")

    but in general field shows only file name not picture and plz also tell me OCX file name

    thanks

    jasvee

    Sunday, June 6, 2010 11:01 AM
  • Yes there is problem in storing general field and you already experienced one of the problems seeing only filename. My suggestions: 1) Preferably use SQL server 2008 and later. Express versions are free and with SQL Server 2008 R2 express you have 10Gb database limit (a database means all the tables, indexes, stored procs ... Limit is not per table) which is enough for many VFP based applications. In SQL Server 2008 there is FILESTREAM attribute. Using that you can store your pictures in database yet they are stored separately on disk. Those files do not count against database 10Gb limit. Storage and retrieval are under SQL server's control because to you it is just another field in the table. You wouldn't have problems if that is a remote location where you have access to database (with VFP and storing paths only you may guess the problems). OTOH you may not want to use SQL server with cursoradapter for your particular reasons. 2) Storing just the paths is general suggestion but that has problems as well (security at least). You may still like to store in a table. Then create a separate table just for those pictures with one primary key ID field + one BLOB. Table has 1-to-1 relation with your employee table then. To show picture, you use an Image control and set its PictureVal property to your picTable.Picture. If you are using VFP SP1 (like me) and working under win7 64 then pictureval has a bug (corrected in SP2 as they say). To workaround I created a simple class:

    define class ImageControl as Image
    Procedure PictureVal_Assign
    Lparameters vNewVal
    If Val(Os(3)) < 6
     This.PictureVal = m.vNewVal
    Else
     If !Empty(This.Tag)
      Erase (This.Tag)
     Endif
     This.Tag = Forcepath(Sys(2015)+'.pic',Sys(2023))
     Strtofile(m.vNewVal,This.Tag)
     This.Picture = This.Tag
    Endif
    endproc
    
    Procedure Destroy
    If !Empty(This.Tag)
      Erase (This.Tag)
    Endif
    endproc
    enddefine
    
    
    • Proposed as answer by Naomi N Sunday, June 6, 2010 5:29 PM
    • Marked as answer by Liliane Teng Friday, June 11, 2010 9:07 AM
    Sunday, June 6, 2010 12:56 PM
  • Thanks Cetin for your valueable time and good opinion, Unfortunately I did not link to "Sql server 2008". Can you plz tell me, how link with Sql database with vfp9. and how I use the table created in Sql. and how to store data in that table.

    thanks Cetin

    Sunday, June 6, 2010 1:42 PM
  • There are many ways. For example in help check CursorAdapter.
    • Marked as answer by Liliane Teng Friday, June 11, 2010 9:07 AM
    Sunday, June 6, 2010 2:06 PM
  • Monday, June 7, 2010 10:18 AM