PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WEBDEV 2024 → Programmatically created images completely blue
Programmatically created images completely blue
Iniciado por Stef, 22,mar. 2013 12:20 - 5 respuestas
Miembro registrado
45 mensajes
Publicado el 22,marzo 2013 - 12:20
Hi all,

WebDev keeps puzzling me.
This time code that, in WinDev
- perfectly imports an XML
- extracts a base64 encoded string from within the XML
- and cnoverts this string into an image with which I can fill an existing display control in a window

in WebDev consistently fills the existing image control in a page with nothing but a solid blue color.

Here's the code that works in WinDev but not in WebDev:

IF XMLFound("XMLdoc") THEN
wp_string =XMLData("XMLdoc")
gsDrawingBase64=wp_string
sResultstring = Uncrypt(wp_string,"",cryptNone)
Page_Main1.IMG_Wp_dwg=sResultstring
Page_Main1.IMG_Wp_dwg..Visible=True
END

Any help would be enormously appreciated because this issue is really setting me back big time.
Publicado el 22,marzo 2013 - 14:42
Hi Stefan

directly setting an image with the content of a string is a recent
addition to the windev possibilities. Before that, an image control
could accept only the path of an image on disk.

As webdev is always a few steps back compared to windev, I suppose that
the problem is coming from there, and that you should first save your
image on disk, then load your image control with the file

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


On 3/22/2013 6:19 AM, Stef wrote:
Hi all,

WebDev keeps puzzling me.
This time code that, in WinDev
- perfectly imports an XML
- extracts a base64 encoded string from within the XML
- and cnoverts this string into an image with which I can fill an existing display control in a window

in WebDev consistently fills the existing image control in a page with nothing but a solid blue color.

Here's the code that works in WinDev but not in WebDev:

IF XMLFound("XMLdoc") THEN
wp_string =XMLData("XMLdoc")
gsDrawingBase64=wp_string
sResultstring = Uncrypt(wp_string,"",cryptNone)
Page_Main1.IMG_Wp_dwg=sResultstring
Page_Main1.IMG_Wp_dwg..Visible=True
END

Any help would be enormously appreciated because this issue is really setting me back big time.

Miembro registrado
45 mensajes
Publicado el 22,marzo 2013 - 16:46
Thank you for your answer.
I tried what you suggested, but when I save the decrypted base64 string (which is an encryption of a JPG file) to disk using dSaveImageJPEG the image saved to disk is the same as what I get on screen: a completely blue image.

It looks as if Uncrypt function simply does not work in WebDev, or at least not in the same way as it does in WinDev. Or am i missing something else ?
Publicado el 22,marzo 2013 - 17:01
Hi Stefan

dSaveImageJPG saves the content of an image CONTROL as a file... As you
do not have an image in your control, you cannot GAIN anything by using
this function...

I would try instead to :
- use a BUFFER instead of string to get the result of uncrypt (as it
will contain binary data, and possibly ZEROS, which are used as End Of
String character)
- save the buffer with fSaveText, as a jpg file, and reload it. If your
based 64 encoding data contains the whole file (header and all, it
should work)

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


On 3/22/2013 10:13 AM, Stef wrote:
Thank you for your answer.
I tried what you suggested, but when I save the decrypted base64 string (which is an encryption of a JPG file) to disk using dSaveImageJPEG the image saved to disk is the same as what I get on screen: a completely blue image.

It looks as if Uncrypt function simply does not work in WebDev, or at least not in the same way as it does in WinDev. Or am i missing something else ?
Publicado el 22,marzo 2013 - 17:43
Thank you very much Fabrice, all it took for this issue to be resolved was changing the variable type to buffer, an export to file was not even necessary !!
Miembro registrado
45 mensajes
Publicado el 22,marzo 2013 - 18:20
Thank you very much Fabrice, all it took for this issue to be resolved was changing the variable type to buffer, an export to file was not even necessary !!