Page 1 of 1

It is possible to put an url image (from Internet) to screen

Posted: Fri Feb 12, 2016 3:02 pm
by Fasasoftware
It is possible to put an url address image from Internet that change into a sprite on a windowed screen and update it every second??

Thanks a lot

Lestroso :oops:

Re: It is possible to put an url image (from Internet) to sc

Posted: Fri Feb 12, 2016 3:08 pm
by sworteu
you should be able to do this http://www.spiderbasic.com/documentatio ... image.html
As you see in the documentation.

Re: It is possible to put an url image (from Internet) to sc

Posted: Fri Feb 12, 2016 3:11 pm
by Fasasoftware
Thanks a lot.....but there're no examples code in the help as you can see......can somebody help me?

Best regards,
lestroso :shock:

Re: It is possible to put an url image (from Internet) to sc

Posted: Tue Feb 16, 2016 11:31 am
by SparrowhawkMMU
I can't get this to work either - I have tried to use the code in the LoadImage() Help file example here:
https://www.spiderbasic.com/documentati ... image.html

I have replaced "Data/SpiderBasicLogo.png" with "https://www.spiderbasic.com/img/logo.png" but no image shows.

Here is the code:

Code: Select all

Procedure Loaded(Type, Filename$, ObjectId)

	; Display the image in a new window
	OpenWindow(#PB_Any, 10, 10, 300, 300, "Image", #PB_Window_SizeGadget)
	ImageGadget(#PB_Any, 0, 0, ImageWidth(ObjectId), ImageHeight(ObjectId), ImageID(ObjectId))
    
EndProcedure
  
Procedure LoadingError(Type, Filename$, ObjectId)
  	Debug Filename$ + ": loading error"
EndProcedure
  
; Register the loading event before calling any resource load command
BindEvent(#PB_Event_Loading, @Loaded())
BindEvent(#PB_Event_LoadingError, @LoadingError())

LoadImage(0, "https://www.spiderbasic.com/img/logo.png")
Note: I have also tried with an image on an http endpoint on our company homepage, as opposed to https, in case that was the reason. Same thing: no image shows my end.

Re: It is possible to put an url image (from Internet) to sc

Posted: Tue Feb 16, 2016 12:54 pm
by SinisterSoft
That gadget is for images loaded, you could use the webgadget instead...

Code: Select all

  If OpenWindow(0, 0, 0, 1000, 500, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    WebGadget(0, 10, 10, 900, 480, "http://www.sinistersoft.com/images/dungeons1.png")
  EndIf

Re: It is possible to put an url image (from Internet) to sc

Posted: Tue Feb 16, 2016 1:24 pm
by Fred
It should work if it's loaded from the same domain, or if the server accept CORS requests.

Re: It is possible to put an url image (from Internet) to sc

Posted: Tue Feb 16, 2016 3:34 pm
by SparrowhawkMMU
@fred Ah yes of course - I forgot CORS again - sorry! :oops:

@SinisterSoft: thank you. Simple when you see it. :oops: (again)