You can generate desired sticker by specifying some parameters in the URL:
-
text - stickers containing text
-
color1 - first color of the two-color combination, corresponds to the available color themes for the template
-
color2 - first color of the two-color combination, corresponds to the available color themes for the template
-
parameter - those stickers that only show one parameter, options:
- T - temperature
- H - humidity
- P - pressure
- W - wind speed
- G - wind gust
- A - apparent temperature
- D - dewpoint
- S - solar radiation
-
sticker types available:
-
sticker800_170 - sticker 800 x 170 px
-
sticker800_150 - sticker 800 x 150 px
-
sticker200_250 - sticker 200 x 250 px
-
sticker200_120 - sticker 200 x 120 px with text
-
sticker200_120icon - sticker 200 x 120 px with icon
-
sticker150_30 - sticker 150 x 30 px
-
interactive sticker - scroll to the bottom for more info
The URL of the image will therefore look like this:
....YOUR PAGE URL ... /plugins/stickers/sticker200_120.php?parameter=T&text=Hello&color1=grey&color2=dark_red
The 800x170px sticker also shows image of your station. What you need to do to show the correct image is very simple. In the plugin folder there is another directory called "stations". Inside this directory you will find images for various station models. Choose the one you want. Take this file and paste it directly in the sticker plugin folder. You will see there is already a file station.png, this is the default. What you need to do is simply replace this file with the one you choose - i.e. delete the original station.png, paste one from the stations folder and rename it again to station.png.
Below are some examples, you can view the image URL to see the parameters used for that particular sticker.
The interactive sticker offer much more possibilities for setting it up.
The only required parameter is "text" - this is what will show up in the sticker heading.
Now let's look at the optional parameters for the default version of the sticker.
In this plugin directory is a directory 'bgs'. Inside it are backgrounds numbered 1,2,3,.... which you can choose from. Likewise, there is a folder 'fonts', where you can specify the font type. If you only pass the parameter text, a default background and font will be used. However, you can customize the look and feel of the sticker much more by specifying additional paramters, let's have a look at them:
-
text - sticker heading
-
image - it is possible to include an image in the sticker. It will be on the left hand side. Your image must be in the 'imgs' directory of this plugin and must have a width and height of 170px. Also, the image must be in the PNG format, using extension '.png'. Then simply set the "image" parameter in the URL to the name of the image, avoid using spaces and unusual symbols in the image name. Ideally use just numbers - eg. 'img01.png' would look like image=img01.
In addition, it is possible to use a random image. In such case, set image to random:
image=random
In this case, the plugin will randomly choose one image from the imgs directory.
-
bg - the number of the background to be used
-
dualUnits - if you include "dualUnits=1", the interactive sticker will show both your chosen template units and in smaller font also the alternative unit (eg. C/F, hPa/inHg, km/h/mph etc.)
-
color - this is the color of the text and icons on the background. Obviously this will depend on which background image you use. For light backgrounds make sure to use black, for dark backgrounds, use white.
Options:
- black
- white
-
shadow - sometimes it is difficult to choose one particular font color, because one part of the background is light and the other dark. In such case you can use the shadow parameter to insert a shadow to the text, which has the opposite color - in other words, a white text will have a black shadow and vice versa. This way you can make your text visible even on backgrounds with light and dark parts.
Options:
0 - no shadow
1 - shadow
-
font - look inside the 'fonts' directory of this plugin and choose the one you want
-
bgColor - color of the background, default is black. If you set a certain border, then this is the color of the border since it is behind the rest. It must be specified in the HEX format, without the "#" symbol. So for example white would be "ffffff" etc.
-
border - this specifies the width of the border. Setting this to 0 would result in no border at all. Use a number between 0 and 10.
Variable
It is also possible to set a variable sticker. One option is use simply a random background, in such case, you simply specify "type=random". You do not give a background number and color. However, in such case a shadow will be used because since the background is random, it can be both dark and light, so we need to make sure the text is visible. In addition to "text" you can specify the "border" and "font".
Probably a more interesting option however, is the option "type=interactive". This is how this option works:
- Sun rise and sun set is calcualted for your location
- The script determines what time of the day it is. There are several options - day, night, sun rise and sun set. Sun rise is a one-hour interval in the middle of which is the sun rise. In other words 30 minutes before and 30 minutes after sun rise. Likewise, sun set is 30 minutes before and 30 minutes after sun set. Everything that is between those two intervals is "day" and everything before sun rise or after sun set interval, is night.
- Based on the time of the day, the script chooses a random background corresponding to that time period
- Then, it looks at current rain rate and if it determines that it is more than 0, i.e. it is just raining, it will choose a background with rain drops.
- Finally, if you have a solar sensor and if the solar radiation is currently above 800 W/m2, an image with a sun and sunny weather is chosen as a background.
In the interactive option, you can still specify the border and the font type, font color is chosen automatically based on background type. And of course you choose the text, which is always required.
Best thing to do is just play around with it. But just to give you some examples:
the beginning for the interactive sticker is always like this:
mysite.com/plugins/stickers/stickerInteractive.php?....
-
?text=Meteotemplate&bg=1
This would create a sticker with the default font (Ubuntu), background image 1, text Meteotemplate, with no image and default border width (5) and default font color white and default shadow setting (enabled)
-
?text=Hello%20World&bg=80&border=2&bgColor=ffffff
This would create a sticker with the default font (Ubuntu), background image 80, text Hello World (note, the '%20' is code for space in URLs), with no image, border width 2 and the border and the background would have a white color (ffffff) and default font color white and default shadow setting (enabled)
-
?text=Meteotemplate&bg=150&shadow=0&image=city&font=Atma-Bold&color=black
This would create a sticker with the text 'Meteotemplate', default border width (5), using font Atma-Bold, with no shadow, font color black (see parameter color, remember you can use either black or white) and on the left would be the image "city.png" that must therefore exist in the imgs directory.
-
?text=Hello%20World&type=random
This would create a sticker with all the default parameters and a random background image.
-
?text=Hello%20World&type=christmas
This will use various Christmas-theme backgrounds.
-
?text=Hello%20World&type=random&border=0
This would create a sticker with all the default parameters and a random background image with no borders.
-
?text=Hello%20World&type=random&image=random
This would create a sticker with all the default parameters and a random background image and random image.
-
?text=MyText&type=interactive
This would create a sticker with all the default parameters and interactive background (based on time of the day and conditions)
There are endless examples I could use, just play around trying different settings to find the one that suits you best. You can upload as many images as you want in the 'imgs' directory.