mostrar foto de campo blob

Consultas, trucos, consejos. Todo sobre Clarion en todas sus versiones
Responder
marce
Novato
Mensajes: 20
Registrado: Mié Jul 29, 2015 8:24 pm
Contactar:

mostrar foto de campo blob

Mensaje por marce » Jue Feb 18, 2016 4:33 pm

hola, como muestro una foto grabada en un campo blob en un window


HDMadeira
Al nivel de RZ
Mensajes: 306
Registrado: Dom Feb 06, 2011 10:02 pm
Ubicación: Trelew, Chubut, Argentina
Contactar:

Re: mostrar foto de campo blob

Mensaje por HDMadeira » Jue Feb 18, 2016 5:03 pm

Del Help de clarion...

Memo and Blob variables are capable of storing large variable length chunks of binary data. This makes them suitable for storing graphic images. MEMOs are limited to 64K or less. BLOBS have no size limit. Storing and displaying images with Memo or Blob variables requires the following:



Storing Graphic Images in BLOBs or MEMOs

To store the graphic image into the MEMO or BLOB variable, channel it through an IMAGE control.

That is, assume the image resides in C:\IMAGES\IMAGE.BMP. We need to transfer the .BMP file to a CW IMAGE control, then transfer from the IMAGE control to the MEMO or BLOB variable.

1. The BLOB or MEMO variable must have the BINARY attribute.

In the Data Dictionary, use the Field Properties dialog's General tab to set the Data Type to MEMO or BLOB, then check the Binary box.

2. Assign the image file to an IMAGE control.

In the Image Properties dialog, in the File field, use the ellipsis (...) button to name the file containing the graphic image.

or

Assign the file name with Clarion's property syntax as follows:

?Image1{PROP:Text} = filename

3. Transfer the image from the IMAGE control to the MEMO or BLOB variable using Clarion's property syntax:

For MEMOs:

CON:TheMemo = ?Image1{PROP:ImageBits}

For BLOBs:

CON:TheBlob{PROP:Handle} = ?Image1{PROP:ImageBlob}



Displaying Graphic Images from BLOBs or MEMOs

To restore (ie display) the image from a BLOB or MEMO to an IMAGE control, you must properly define the size of the IMAGE control. The IMAGE control must either be of Default size, or of a fixed size set after the MEMO or BLOB data is assigned to it.

1. To set the IMAGE control to default size.

In the Image Properties dialog, on the Position tab, check the Default boxes for Height and Width.

2. Use Clarion's property syntax to transfer the MEMO or BLOB data to the IMAGE control.

For MEMOs:

?Image2{PROP:ImageBits} = CON:TheMemo

For BLOBs:

?Image2{PROP:ImageBlob} = CON:TheBlob{PROP:Handle}

3. After the MEMO or BLOB has been assigned to the IMAGE with property syntax, a fixed width and height may be assigned to the IMAGE Control:

?Image2{PROP:Width} = 92

?Image2{PROP:Height} = 88



The shipping SCHOOL example demonstrates using property assignments fo

carlin
Novato
Mensajes: 38
Registrado: Dom Mar 30, 2014 3:23 am
Contactar:

Re: mostrar foto de campo blob

Mensaje por carlin » Vie Feb 19, 2016 5:49 pm

Hola:

aca tenes un ejemplo que creo que te va a servir:

http://www.evolutionconsulting.com.ar/d ... l-blob.zip

si bien es para el driver MsSql, pero el codigo te va a ser util.

Carlos

carlin
Novato
Mensajes: 38
Registrado: Dom Mar 30, 2014 3:23 am
Contactar:

Re: mostrar foto de campo blob

Mensaje por carlin » Vie Feb 19, 2016 5:59 pm

Tambien puede ayudar esto que fue pulicado por Chris Kloss
en comp.lang.clarion:
!ACD FORM
!This is an embed under a button
!Retrieve & Display photo from selected disk file
IF NOT TARGET{PROP:AcceptAll}
?Image1{PROP:NoWidth} = TRUE
?Image1{PROP:NoHeight} = TRUE
?Image1{PROP:Text} = ImageFile
ACC:Sketch{Prop:Handle}= ?Image1{PROP:ImageBlob} ! rw
DO DisplayImage
SketchChanged = TRUE
END

!This is an embed under the OK button
!Update Photo BLOB on DISK ! rw
IF SketchChanged = TRUE ! rw if we changed
LocalRequest=RequestCompleted ! rw tell system
ACC:Sketch{PROP:size} = 0 !rw
ACC:Sketch{PROP:Handle} = ?Image1{PROP:ImageBlob} !rw
END !Display image from
?Image1{PROP:NoWidth} = TRUE
?Image1{PROP:NoHeight} = TRUE
?Image1{PROP:ImageBlob} =acc:sketch{prop:handle}
DO DisplayImage

!In ProcedureRoutines
DisplayImage ROUTINE
IF ?Image1{PROP:Height} > 225
AspectRatio$ = ?Image1{Prop:Width}/?Image1{PROP:Height}
?Image1{PROP:Height} = 225
?Image1{PROP:Width} = 225 * AspectRatio$
END
IF ?Image1{PROP:Width} > 225
AspectRatio$ = ?Image1{Prop:Height}/?Image1{PROP:Width}
?Image1{PROP:Width} = 225
?Image1{PROP:Height} = 225 * AspectRatio$
END

!REPORT...
!After Opening Report
!Assign BLOB to IMAGE control
Report$?image2{PROP:NoWidth} = TRUE
Report$?image2{PROP:NoHeight} = TRUE
Report$?image2{PROP:ImageBlob} = acc:sketch{PROP:Handle}
IF Report$?image2{PROP:Height} > 3180
AspectRatio$ = Report$?image2{PROP:Width}/Report$?image2{PROP:Height}
Report$?image2{PROP:Height} = 3180
Report$?image2{PROP:Width} = 3180 * AspectRatio$
END
IF Report$?image2{PROP:Width} > 3180
AspectRatio$ = Report$?image2{PROP:Height}/Report$?image2{PROP:Width}
Report$?image2{PROP:Width} = 3180
Report$?image2{PROP:Height} =3180 * AspectRatio$
END


--
regards,

chris
ckloss@mcsystems.net

marce
Novato
Mensajes: 20
Registrado: Mié Jul 29, 2015 8:24 pm
Contactar:

Re: mostrar foto de campo blob

Mensaje por marce » Mar Feb 23, 2016 2:11 pm

Muchas Gracias :D


Responder

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 3 invitados