FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour saving image file to blob fields
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
saving image file to blob fields
Posted: Mon Jun 09, 2008 03:06 AM
Anybody...


I'm working on ADS71 (CDX) and this function always returns false...

db->( adsfiletoblob('file.bmp', 'field', 7) )

//'field' is image type defined in arc32
//7 means image or 6 means binary

I thought of changing table from CDX to ADT... and so.

still returns false.

I changed field type to binary... still CANT SAVE IMAGE FILE TO FIELD...



If db->( dbRLock( recno() ) )

   if db->( adsfile2blob('d:\images\picture.bmp', 'MAP', 7) )
      msginfo('file image saved to table')
   else
     msginfo('unable to save')  
   end

end



anybody with the workaround is truly appreciated.


regards,
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
saving image file to blob fields
Posted: Mon Jun 09, 2008 07:54 AM

Frances,

This may be useful from Harbour ADS RDD docs:

<nBinaryType> Either ADS_BINARY (the default) or ADS_IMAGE. This parameter is for fields in DBF files. ADT tables cannot store binary and image data in standard character memo fields (they have specific field types for that).

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
saving image file to blob fields
Posted: Mon Jun 09, 2008 09:11 AM

Hello Mr. Antonio,

Thank you for the reply.

ADS_BINARY is 6 ands ADS_IMAGE is 7.

I used it in the third parameter (like the above) ADSFile2Blob('file','field',7)

I data type for 'field' is image or binary (ADT) but still not working...

Maybe there's problem with the wrapper ADSFile2Blob and, ADSBlob2File.

Anyone with a fix?

Regards,

Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
saving image file to blob fields
Posted: Mon Jun 09, 2008 10:56 AM

Frances,

The C wrapper seems ok:

ulRetVal = AdsFileToBinary( pArea->hTable, (UNSIGNED8)szFieldName, usBinaryType, (UNSIGNED8)szFileName );

it returns a logical value. Do you get .T. or .F. ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
saving image file to blob fields
Posted: Mon Jun 09, 2008 03:08 PM

Hello again Mr. Antonio,

The above coding returns .F. ( adsFile2blob() )...

Can I use the adsfilebinary() directly from xhb1.1/fivewin? If so how do you pass the parameter? adsfile2blob is much easier but I get .F. return.

Best regards,

Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
saving image file to blob fields
Posted: Tue Jun 10, 2008 01:58 AM
OH MY GOD!!! I'M SO SORRY MR. ANTONIO...


The above is so true and correct! :-)


my mistake was that the alias 'DB' is positioned EOF... :-) :-) :-)


that is why the adsfile2blob is returning FALSE....



IT'S WORKING PERPECTLY.....


Regards to you Mr. Antonio :-)
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15

Continue the discussion