It is currently March 29th, 2024, 5:49 am

Display image from web

Get help with creating, editing & fixing problems with skins
eng3
Posts: 13
Joined: November 11th, 2017, 3:06 am

Display image from web

Post by eng3 »

I'm trying to display an image from the web and have it update every 10min, however when I load the skin, nothing shows up. Checking the cache, I see it tries to download the image but the contents of the file are empty. I tried a google image link where it does successfully download the image, but it still doesnt show up.

Code: Select all

[Rainmeter]
Update=600000
BackgroundMode=1

[MeasureImage]
Measure=Plugin
Plugin=WebParser
URL=https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png
Download=1

[MeterImage]
Meter=Image
MeasureName=MeasureImage
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display image from web

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
BackgroundMode=1

[MeasureImage]
Measure=WebParser
URL=https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png
Download=1

[MeterImage]
Meter=Image
MeasureName=MeasureImage
The key is the DynamicWindowSize=1 in the [Rainmeter] section. When the skin is first loaded, and during the first update of the measures and meters, the WebParser measure has not yet had time to download the image, so the size of the skin is 0 by 0. Unless you allow the skin window to dynamically grow on the next update, or whenever the image has in fact arrived, the skin will stay at 0 by 0...

Second, I NEVER recommend an Update rate greater than 1000. There is just no reason for having the WebParser measure get the image, and then wait 10 minutes to display it. If the intent is to only get the image once, and not keep going back every 10 minutes and getting it again, then you probably want to use UpdateRate=-1 on the WebParser measure. That will only go out to the resource once when the skin is loaded or refreshed. Leave Update=1000, unless you need things to happen "quicker", when you might use a smaller update. Almost never use a large one.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display image from web

Post by jsmorley »

Sorry, I misread. If the intent is to have WebParser go after the resource every 10 minutes, use UpdateRate=600 on the WebParser measure. Never use Update or UpdateDivider to control a WebParser measure. Only use UpdateRate.

By the way, UpdateRate=600 is the "default" for WebParser if you don't put one at all...
eng3
Posts: 13
Joined: November 11th, 2017, 3:06 am

Re: Display image from web

Post by eng3 »

Thanks, now I see something being displayed. It still wont download the image I want to download. When I look at the cache, it has a file, but it is empty.
The image is dynamically generated from my google cloud account. It can be slow to load.

As for update, my intent is to have it get the image every 10min.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display image from web

Post by jsmorley »

eng3 wrote: June 25th, 2020, 2:53 am Thanks, now I see something being displayed. It still wont download the image I want to download. When I look at the cache, it has a file, but it is empty.
The image is dynamically generated from my google cloud account. It can be slow to load.

As for update, my intent is to have it get the image every 10min.
It may not be possible to download that using WebParser. WebParser can't "log in" to your account.
eng3
Posts: 13
Joined: November 11th, 2017, 3:06 am

Re: Display image from web

Post by eng3 »

No login is required, it is a public URL.
I PMed you
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Display image from web

Post by balala »

eng3 wrote: June 25th, 2020, 2:53 am Thanks, now I see something being displayed. It still wont download the image I want to download. When I look at the cache, it has a file, but it is empty.
It's working for me, using your initial code, which I updated with the Update=1000 option and added the DynamicWindowSize=1 option, both to [Rainmeter] section. It downloads a Google logo:
GIF.gif
If still doesn't work, try restarting Rainmeter. I mean completely restarting it: right-click its icon in the system tray, click Exit and start it again, they try again your skin.
You do not have the required permissions to view the files attached to this post.
eng3
Posts: 13
Joined: November 11th, 2017, 3:06 am

Re: Display image from web

Post by eng3 »

Yes, the google image works, however when I substitute in the URL for the image I want to download it just downloads an empty file eventhough it looks fine in the browser.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Display image from web

Post by balala »

eng3 wrote: June 25th, 2020, 11:32 am Yes, the google image works, however when I substitute in the URL for the image I want to download it just downloads an empty file eventhough it looks fine in the browser.
And what is the URL of the image you want to download?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display image from web

Post by jsmorley »

I don't know, it's working for me...

That site is VERY slow, so do be careful not to hammer refresh trying to get it to work, or you WILL hang WebParser and need to restart Rainmeter. You have to load the skin and just wait patiently. It might take 30 seconds to get the image.

It is unfortunate that making the URL public is an issue, as that does make it hard for others to help you here.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
BackgroundMode=1

[MeasureImage]
Measure=WebParser
URL=[site redacted].com/radar.png?lattitude=40.75&longitude=-73.993
Download=1
UpdateRate=600

[MeterImage]
Meter=Image
MeasureName=MeasureImage
As I said before, set Update=1000 in [Rainmeter]. Then, if you want to change from the default of 10 minutes in WebParser, do that with UpdateRate in the WebParser parent measure.