In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

how to put a photo into a Image field (ADS)

Xailer English public forum
Responder
Roberto
Mensajes: 177
Registrado: Mar Oct 16, 2007 11:53 pm

how to put a photo into a Image field (ADS)

Mensaje por Roberto »

Hi,
Nice product! :o)
I have a table with a column named "Photo" and it's type is Image (from ADS).
It's ok, but how can I use it?
tks
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

how to put a photo into a Image field (ADS)

Mensaje por jfgimenez »

Roberto,
> Nice product! :o)
Thanks!
> I have a table with a column named "Photo" and it's type is Image (from
> ADS).
> It's ok, but how can I use it?
You may use the method SaveToStream() from TPicture; it returns a buffer
containing the image data, which can be stored where you want.
Later, to recover and show the image, you may use the method
LoadFromStream()
--
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Roberto
Mensajes: 177
Registrado: Mar Oct 16, 2007 11:53 pm

how to put a photo into a Image field (ADS)

Mensaje por Roberto »

Very nice product!
Ok, I understood how can I manipulate the Image object, tks.
But I still have a problem: I can't write the image to a field type Image
(ADS) cause I get an error telling me it was expecting a data type Image
and it is getting a Char type value. I can save it to a memo field, but it
does not sounds good.
"Jose F. Gimenez" <jfgimenez@wanadoo.es> wrote:
>Roberto,
>
>> Nice product! :o)
>
>Thanks!
>
>
>> I have a table with a column named "Photo" and it's type is Image (from
>> ADS).
>> It's ok, but how can I use it?
>
>You may use the method SaveToStream() from TPicture; it returns a buffer
>containing the image data, which can be stored where you want.
>
>Later, to recover and show the image, you may use the method
>LoadFromStream()
>
>--
>Regards,
>
>Jose F. Gimenez
>http://www.xailer.com
>http://www.xailer.info
>
>
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

how to put a photo into a Image field (ADS)

Mensaje por jfgimenez »

Roberto,
> But I still have a problem: I can't write the image to a field type Image
> (ADS) cause I get an error telling me it was expecting a data type Image
> and it is getting a Char type value. I can save it to a memo field, but it
> does not sounds good.
It seems there is something incorrect in rddads, or simply it doesn't allow
to write any binary data on it. Notice that xHarbour doesn't have a native
'image' datatype, so it is stored to memory in a character variable.
ITOH, I don't see any problem in using a memo field to store an image using
ADS (server). It's supposed that ADS server is very reliable, so there
should be no problem.
BTW, I've just readed in another forum that Miguel Angel Marchuet has just
implemented new datatypes to rdd system, so it's possible that it could be
possible in a short time.
--
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9466
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

how to put a photo into a Image field (ADS)

Mensaje por ignacio »

Roberto,
/* $DOC$
* $FUNCNAME$
* ADSBlob2File()
* $CATEGORY$
* Advantage Database RDD
* $ONELINER$
* Write a Binary (memo) field's contents to a file
* $SYNTAX$
* ADSBlob2File(cFileName, cFieldName) --> lSuccess
* $ARGUMENTS$
* <cFileName> File to create. If it already exists, it will be
* overwritten on success and destroyed on error.
*
* <cFieldName> Field in the current workarea that contains binary
data.
*
* $RETURNS$
* <lSuccess> True if the file is successfully written.
* $DESCRIPTION$
* See ACE.HLP for full details about the Advantage Database Server.
* ADSBlob2File() is a wrapper for AdsBinaryToFile.
* $EXAMPLES$
* $TESTS$
* $STATUS$
* R
* $COMPLIANCE$
* Harbour extension
* $PLATFORMS$
* Windows 32-bit only
* $FILES$
* Library is RddAds
* Header is ads.ch
* $SEEALSO$
* ADSFile2Blob()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* ADSFile2Blob()
* $CATEGORY$
* Advantage Database RDD
* $ONELINER$
* Save a Binary file to a field
* $SYNTAX$
* ADSFile2Blob(cFileName, cFieldName, <nBinaryType>) --> lSuccess
* $ARGUMENTS$
* <cFileName> File to read. Can be in UNC format. A common example
is an image file.
*
* <cFieldName> Field in the current workarea to contain the binary
data.
*
* <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).
* $RETURNS$
* <lSuccess> True if the file is successfully written.
* $DESCRIPTION$
* See ACE.HLP for full details about the Advantage Database Server.
* ADSFile2Blob() is a wrapper for AdsFileToBinary.
* Use of this function is illegal in an ADS transaction.
* $EXAMPLES$
* $TESTS$
* $STATUS$
* R
* $COMPLIANCE$
* Harbour extension
* $PLATFORMS$
* Windows 32-bit only
* $FILES$
* Library is RddAds
* Header is ads.ch
* $SEEALSO$
* ADSBlob2File()
* $END$
*/
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"roberto" <roberto@top2.com.br> escribió en el mensaje
news:46521b80$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>
> Very nice product!
>
> Ok, I understood how can I manipulate the Image object, tks.
> But I still have a problem: I can't write the image to a field type Image
> (ADS) cause I get an error telling me it was expecting a data type Image
> and it is getting a Char type value. I can save it to a memo field, but it
> does not sounds good.
>
> "Jose F. Gimenez" <jfgimenez@wanadoo.es> wrote:
>>Roberto,
>>
>>> Nice product! :o)
>>
>>Thanks!
>>
>>
>>> I have a table with a column named "Photo" and it's type is Image (from
>
>>> ADS).
>>> It's ok, but how can I use it?
>>
>>You may use the method SaveToStream() from TPicture; it returns a buffer
>
>>containing the image data, which can be stored where you want.
>>
>>Later, to recover and show the image, you may use the method
>>LoadFromStream()
>>
>>--
>>Regards,
>>
>>Jose F. Gimenez
>>http://www.xailer.com
>>http://www.xailer.info
>>
>>
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Responder