Page 1 of 2
Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 3:49 pm
by Kwai chang caine
Hello at all
Is it possible to send directly an image in DATA to a WebGadget ??
Code: Select all
Enumeration
#Form0
#Web0
#Bouton0
#Image
EndEnumeration
OpenWindow(#Form0, 216, 0, 397, 340, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
WebGadget(#Web0, 12, 18, 372, 291, "about:blank")
ButtonGadget(#Bouton0, 104, 315, 182, 20, "")
Repeat
Evenement = WaitWindowEvent()
If Evenement = #PB_Event_Gadget
Select EventGadget()
Case #Bouton0
ImageID = CatchImage(#Image, ?FlagImage)
SetGadgetText(#Web0, "???")
EndSelect
EndIf
Until Evenement = #PB_Event_CloseWindow
End
DataSection
FlagImage:
IncludeBinary "Image.jpg"
EndDataSection
Have a good day
Re: Send data image to WebGadget
Posted: Sun Jan 15, 2012 5:05 pm
by infratec
Hi,
I think it is not possible to do it 'directly'.
In my opinion it is only possible to save the 'catched' image to the harddisk
Like this:
Code: Select all
Select EventGadget()
Case #Bouton0
ImageID = CatchImage(#Image, ?FlagImage)
TmpImgFilename$ = GetTemporaryDirectory() + "test.bmp"
SaveImage(#Image, TmpImgFilename$)
SetGadgetItemText(#Web0, #PB_Web_HtmlCode, "<img src=" + #DQUOTE$ + TmpImgFilename$ + #DQUOTE$ + "></img>")
Case #Web0
If EventType() = #PB_EventType_DownloadEnd
If Len(TmpImgFilename$)
DeleteFile(TmpImgFilename$)
TmpImgFilename$ = ""
EndIf
EndIf
EndSelect
Bernd
Re: Send data image to WebGadget
Posted: Sun Jan 15, 2012 6:24 pm
by Kwai chang caine
It seemed as though it was impossible.
Even with PB, it is not used, but sometimes it is still impossible to do things

I do like you show to me
So thanks a lot INFRATEC for your precious help
I wish you a good evening
Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 7:53 pm
by wilbert
I don't know if WebGadget supports it but there is a way
http://en.wikipedia.org/wiki/Data_URI_scheme
Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 8:23 pm
by Kwai chang caine
Hello Wilbert

Interesting, i don't know this tips
But apparently that not works with WebGadget
I have try this Data_URI_scheme
Code: Select all
Enumeration
#Form0
#Web0
#Bouton0
EndEnumeration
OpenWindow(#Form0, 216, 0, 397, 340, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
WebGadget(#Web0, 12, 18, 372, 291, "about:blank", #PB_Web_Mozilla)
ButtonGadget(#Bouton0, 104, 315, 182, 20, "Charger le DATA")
Repeat
Evenement = WaitWindowEvent()
Select EventGadget()
Case #Bouton0
SetGadgetItemText(#Web0, #PB_Web_HtmlCode, "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0 vr4MkhoXe0rZigAAAABJRU5ErkJggg==")
EndSelect
Until Evenement = #PB_Event_CloseWindow
End
Normally a red point appears in Firefox...and not in WebGadget, in IE that not works too
Thanks when even for your help

Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 8:33 pm
by - chris -
Hello
two red dots:
Code: Select all
#DQ = Chr(34)
Enumeration
#Form0
#Web0
#Bouton0
EndEnumeration
OpenWindow(#Form0, 216, 0, 397, 340, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
WebGadget(#Web0, 12, 18, 372, 291, "about:blank")
ButtonGadget(#Bouton0, 104, 315, 182, 20, "Charger le DATA")
Repeat
Evenement = WaitWindowEvent()
Select EventGadget()
Case #Bouton0
code$ + "<img src=" + #DQ + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" + #DQ + " alt=" + #DQ + "Red dot" + #DQ + ">" + #CRLF$
SetGadgetItemText(#Web0, #PB_Web_HtmlCode, code$)
EndSelect
Until Evenement = #PB_Event_CloseWindow
End
Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 8:37 pm
by Kwai chang caine
Hello CHRIS

Strange here that not works

Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 8:41 pm
by - chris -
hello
and without #PB_Web_Mozilla ?
Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 8:43 pm
by wilbert
On OS X the dots show up fine.

Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 8:46 pm
by Kwai chang caine
- chris - wrote:hello
and without #PB_Web_Mozilla ?
The same thing, i'm on XP PRO SP3
I have try v4.51 and 4.60 always the same thing
Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 8:51 pm
by - chris -
hello
With full html:
one red dot
Code: Select all
#DQ = Chr(34)
Enumeration
#Form0
#Web0
#Bouton0
EndEnumeration
OpenWindow(#Form0, 216, 0, 397, 340, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
WebGadget(#Web0, 12, 18, 372, 291, "about:blank")
ButtonGadget(#Bouton0, 104, 315, 182, 20, "Charger le DATA")
Repeat
Evenement = WaitWindowEvent()
Select EventGadget()
Case #Bouton0
code$ = ""
code$ + "<html>" + #CRLF$
code$ + "<head>" + #CRLF$
code$ + "</head>" + #CRLF$
code$ + "<body>" + #CRLF$
code$ + "<img src=" + #DQ + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" + #DQ + " alt=" + #DQ + "Red dot" + #DQ + ">" + #CRLF$
code$ + "</body>" + #CRLF$
code$ + "</html>" + #CRLF$
SetGadgetItemText(#Web0, #PB_Web_HtmlCode, code$)
EndSelect
Until Evenement = #PB_Event_CloseWindow
End
Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 8:55 pm
by wilbert
Maybe it has to do with the version of the browser. IE8 supports the Data URI scheme but older IE versions don't.
I don't know if WebGadget relies on the version of IE that is installed.
On my Windows 7 both PB x86 and PB x64 show the dots correctly with or without the #PB_Web_Mozilla flag.
Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 8:58 pm
by netmaestro
Try this one, it works here with mozilla or not:
Code: Select all
Enumeration
#Form0
#Web0
#Bouton0
EndEnumeration
DataSection
world: IncludeBinary #PB_Compiler_Home+"examples\sources\data\geebee2.bmp"
worldend:
EndDataSection
*mem = AllocateMemory((?worldend-?world) * 1.35)
Base64Encoder(?world, ?worldend-?world, *mem, MemorySize(*mem))
a$ = "<html>" + #CRLF$
a$ + "<head>" + #CRLF$
a$ + "</head>" + #CRLF$
a$ + "<body>" + #CRLF$
a$ + "<a href="+Chr(34)+Chr(34)+"><img src="+Chr(34)+"Data:image/bmp;base64,"
a$ + PeekS(*mem)
a$ + Chr(34)+" alt="+Chr(34)+Chr(34)+" width="+Chr(34)+"128"+Chr(34)+" height="+Chr(34)+"128"+Chr(34)+" /></a>"+#CRLF$
a$ + "</body>" + #CRLF$
a$ + "</html>" + #CRLF$
OpenWindow(#Form0, 216, 0, 397, 340, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
WebGadget(#Web0, 12, 18, 372, 291, "about:blank")
ButtonGadget(#Bouton0, 104, 315, 182, 20, "Charger le DATA")
Repeat
Evenement = WaitWindowEvent()
Select EventGadget()
Case #Bouton0
SetGadgetItemText(#Web0, #PB_Web_HtmlCode, a$)
EndSelect
Until Evenement = #PB_Event_CloseWindow
End
Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 9:00 pm
by Kwai chang caine
Maybe it has to do with the version of the browser. IE8 supports the Data URI scheme but older IE versions don't.
Yes you have right..i'm an old man...so i use an old browser IE7
I don't know if WebGadget relies on the version of IE that is installed.
Yes the WebGadget use the browser IE installed in the machine

I believe you have found the problem

Re: Send data image to WebGadget [Resolved]
Posted: Sun Jan 15, 2012 9:13 pm
by Kwai chang caine
Hello NETMAESTRO

I have try with a BMP and JPG your code and have another style of square
