I had run into an issue with retrieving and displaying images from web sites when the source HTML has them referred to as a "relative path" to the image.
As we all know, WebParser can download and display images by doing a WebParser Measure which gets the full URL and name of the image, and setting "Download=1" on the Measure. Then a Meter using Meter=IMAGE with a MeasureName=xxxx referring to the Measure which downloaded the image will display the downloaded image.
The problem came in when the image was referred to in the web site HTML using a relative path to the image. An example is the logo at the top of the page here on the forums:
<a href="./index.php" title="Board index" id="logo"><img src="./styles/saphic/imageset/site_logo.png"/></a>
As you can see, the full URL is not included in anything that WebParser can search for, so Download=1 fails...
A WebParser Measure can append the RESULTS of another WebParser Measure in the "URL" line by referencing the Measure in square brackets. This means you can use the first measure to return the name and location of the image you want, and use this information in a second Measure where you hard code the URL and then pass the result of the search for the image to the second Measure.
Best explanation is an example:
Here we are using the first Measure [MeasureImageLocation] to get the relative path and filename of the image.
Then we use the second Measure [MeasureImageDownload] to combine the known URL and the information from [MeasureImageLocation] to create a fully loaded Measure which will succeed in downloading the image... Then we just display it.
It is currently July 21st, 2019, 9:37 am
Tips and Tricks from the Rainmeter Community
1 post • Page 1 of 1
- Posts: 19301
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA