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

Just starting out? Need help? Post your questions and find answers here.
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

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

Post 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:
sworteu
Posts: 18
Joined: Sun Feb 07, 2016 9:49 am

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

Post by sworteu »

you should be able to do this http://www.spiderbasic.com/documentatio ... image.html
As you see in the documentation.
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

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

Post 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:
User avatar
SparrowhawkMMU
Posts: 291
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

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

Post 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.
User avatar
SinisterSoft
Posts: 77
Joined: Sun Apr 06, 2014 11:41 pm
Location: Preston, UK
Contact:

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

Post 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
Fred
Site Admin
Posts: 1820
Joined: Mon Feb 24, 2014 10:51 am

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

Post by Fred »

It should work if it's loaded from the same domain, or if the server accept CORS requests.
User avatar
SparrowhawkMMU
Posts: 291
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

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

Post by SparrowhawkMMU »

@fred Ah yes of course - I forgot CORS again - sorry! :oops:

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