Until now, displaying temperature data in your webcam images (or other changing information) required the setup of another image processing step in your workflow.

With the new dynamic text overlays you can change texts for every image by calling our API (push mode) or by setting up a website with text data (pull mode).

Setup

To set up dynamic texts go to your webcam settings page and open the “Text overlays” box. Dynamic text are inserted by using variables in the text field. This will insert the current time:

dynamic overlay settings

Custom texts can be set using one (or both) of these ways:

a) Sending data to the API

You have two variables that can be modified using the API:

{dynamic1}
{dynamic2} 

Insert them into the text fields and use something like the curl command for an API call:

curl -H 'Content-Type: application/json' \
     -H 'X-Auth-Email: YOUR@EMAIL' \
     -H 'X-Auth-Key: SECRET_KEY' \ 
     -X PUT -d '{"dynamic_text1":"","dynamic_text2":""}' \
     "https://webcam.io/api/webcams/WEBCAM-ID"

This is an example call:

curl -H 'Content-Type: application/json' -H 'X-Auth-Email: contact@webcam.io' -H 'X-Auth-Key: 22l7kIX0AwdMcdpo7vlL'  -X PUT -d '{"dynamic_text1":"temp: 10°C hyg: 50%","dynamic_text2":"wind: NE"}' "https://webcam.io/api/webcams/m7g61z" 

You get your secret API key from Profile settings. If no key is shown click on ‘create’. The webcam-IDs are listed on your webcams page.

The API call sets the variables to be used for the next image.

b) Fetching data

Another way is inserting the text data from a website. Weather data is a good example – an updating website showing ‘temp: 10°C’ etc.

Example variable:

{url:http://your-domain.com/data.txt} 

The website should contain text only. HTML tags are removed and this leads to strange results.

The fetch is triggered during the image processing, so it is synchronized with your snapshot/upload interval. To keep up with the 15 second image fetch interval there is a timeout of 6 seconds and data is limited to 240 chars.

If there are errors, nothing gets inserted. If you have strange text results please check the URL in source code mode in your browser and check if the website is fast enough.

Summary

For now there are these dynamic text variables:

{timestamp} 
{url:http://your-domain.com/data.txt} 
{dynamic1}
{dynamic2} 

You can always use the ‘Image Preview’ button to see if text content and positioning/size looks ok. And do not forget to save the settings when everything is ok.

That’s it about dynamic text overlays for now.

Please contact us if you have ideas for more dynamic variables :)