INTERACTIVE STICKER # INTERACTIVE STICKER for Weather Display # based on Stickers plugin for Meteotemplate - hundreds of other similar scripts available for the template # Meteotemplate is a free website template - see meteotemplate.com for many more similar plugins and features # http://www.meteotemplate.com # Author: Jachym # jachymcz@gmail.com # Meteotemplate 2016 # License: - free for non-commercial use - no redistribution permitted - Meteotemplate logo and text in bottom right corner must be left untouched # # # if you find this script useful and would like to support the development you can use the PayPal button at # meteotemplate.com. The site is fully non-commercial and ad-free and all contributions are used for # the purpose of this project. ###################################################################################################### The interactive sticker allows you to create a sticker image with current conditions from clientraw.txt. First open stickerInteractive.php and go through the settings at the top! In the stations directory you will find several images corresponding to different station models. Choose the one you want to use, rename it to "station" and replace both the black and white version of it in the root folder. The image will have the URL corresponding to ..../interactiveSticker.php? After the "?" symbol you can add parameters to specify how you want your sticker to look like (see below). Parameters are set like this: ..../interactiveSticker.php?parameter1=value1¶meter2=value2..... 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.
Inside the bgs directory 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 - 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 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: .../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=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.