Page 20 of 24

Re: Cumulus PHP-GD Banner

Posted: Sat Apr 27, 2013 10:05 pm
by beteljuice
background1.jpg in the /images folder
But where is the php file ?
$baseimg = imagecreatefromjpeg("background1.jpg");
Also to avoid any unexpected colour interactions it would be better to:

Code: Select all

$im = @imagecreatetruecolor($SITE['image_width'], $SITE['image_height'])
or die("Cannot Initialize new GD image stream");
See http://sandaysoft.com/forum/viewtopic.p ... 0&start=15

Re: Cumulus PHP-GD Banner

Posted: Wed May 29, 2013 9:36 am
by weatherfrog80
Hi all,

I wanted to replace the current wind speed with the "10 min average wind speed" in my weather banner.
According to realtime.txt that would be the numbers "46" for "degrees" and "51" which shows the bearing in words. However the positions only go from 0 to 39.
Anyone having an idea, how do this?

Best regards

Georg

Re: Cumulus PHP-GD Banner

Posted: Wed May 29, 2013 9:56 am
by steve
weatherfrog80 wrote:According to realtime.txt that would be the numbers "46" for "degrees" and "51" which shows the bearing in words. However the positions only go from 0 to 39. Anyone having an idea, how do this?
You need to extend the 'cvalues' array near the top of the file so that it goes as far as the entry that you need. It doesn't matter what names you use as long as you use the same name later on when you add the item to the banner.

Re: Cumulus PHP-GD Banner

Posted: Wed May 29, 2013 11:56 am
by weatherfrog80
Thanks for your help Steve, that works. :)

Re: Cumulus PHP-GD Banner

Posted: Wed Jun 05, 2013 4:21 pm
by Supercell
Hi is it possible to add custom tags to display in the banner from another file?. For example the Blake-Larsen Sunrecorder application makes a file to be used by Cumulus (which can easily be uploaded using Cumulus alongside the other webfiles of course also).
I've attached an example file with values explained, i'd like to include sun hours today and maybe sunny or not now also if possible in my banner.

Thanks.

Re: Cumulus PHP-GD Banner

Posted: Wed Jun 05, 2013 4:44 pm
by steve
"Sun hours today" and "is it sunny?" are both in realtime.txt, so by extending the cvalues array as previously mentioned, you can include those in the banner.

Re: Cumulus PHP-GD Banner

Posted: Wed Jun 05, 2013 5:07 pm
by Supercell
steve wrote:"Sun hours today" and "is it sunny?" are both in realtime.txt, so by extending the cvalues array as previously mentioned, you can include those in the banner.
Great, thanks very much Steve, I must have overlooked that, i'll get reading.

Re: Cumulus PHP-GD Banner

Posted: Wed Jun 05, 2013 8:33 pm
by Supercell
I cant seem to figure out how to tell the cvalues array where to find the value position i want ?

For example I know that I want to add a custom "sunHR" - hours of sun today which is position 56 in the realtime file, but how to tell that position?
I added it to the reference list, but its obviously not reading that. The value in my signature isn't correct below.

feel like a bit of a thicko :(

Re: Cumulus PHP-GD Banner

Posted: Wed Jun 05, 2013 8:42 pm
by steve
Supercell wrote:I cant seem to figure out how to tell the cvalues array where to find the value position i want ?
You have to fill in all of entries up to the ones you need; that's how it knows which position in realtime.txt corresponds to each item in cvalues. So you need to extend cvalues, like this:

Code: Select all

$SITE['cvalues'] = array(
    "date","time","temp","hum","dew","wspeed","wgust","avgbearing","rrate",
    "rfall","press","wdir","beaufort","windunit","tempunit","pressunit","rainunit",
    "windrun","presstrend","rmonth","ryear","rfallY","intemp","inhum","wchill",
    "temptrendval","tempTH","TtempTH","tempTL","TtempTL",
    "windTM","TwindTM","wgustTM","TwgustTM",
    "pressTH","TpressTH","pressTL","TpressTL",
    "cversion","cbuild","wgust","heatindex","humidex", ... and so on up to... "sunshinehours","currentsolarmax","issunny");
Then you can get the values using ret_value("sunshinehours") and ret_value("issunny")

Re: Cumulus PHP-GD Banner

Posted: Wed Jun 05, 2013 10:08 pm
by Supercell
Ahhhhhhhhhhhhhhhhhh! I see, I was wondering why it is currently showing the 10-minute high gust value :)
I'll get right on it Thanks again :clap:

Re: Cumulus PHP-GD Banner

Posted: Wed Jun 05, 2013 10:44 pm
by Supercell
It works!
Now to add cloudy, sunny and night graphics to the banner based on the realtime .txt ..much more reading needed I feel...

Thanks for your patience and help.

Re: Cumulus PHP-GD Banner

Posted: Thu Jun 06, 2013 1:38 am
by PaulMy
Well done Supercell. I need to look and see if I can do something similar,

Paul

Re: Cumulus PHP-GD Banner

Posted: Thu Jun 06, 2013 8:41 am
by Supercell
Thanks Paul.

I've added sunny, cloudy and night images using the code from earlier in this thread.

Currently looks like :-

Image

I'd like to put the current conditions picture off the end of the banner without text overlaying so making the banner 60px wider I guess , not sure how to do that.
Alternatively make the images transparent, so there isn't a white background as in the image above - do I need new pictures?

Re: Cumulus PHP-GD Banner

Posted: Thu Jun 06, 2013 11:00 pm
by beteljuice
In another post (re. avatar), the beteljuice posted a load of rubbish !

These are the lines you need to modify:

Code: Select all

		imagettftextbox($im, $size, 0, 0, 1, $green, $font3, $text, $SITE['image_width'], "right");
These are the (ttf font) options for right justified text.

$SITE['image_width'] is the furthermost right 'edge' that the text justifies to (less a 5px margin).
So if you replace $SITE['image_width'] with your pretend right-hand (text) extreme, everything should be hunky dory - I think

Re: Cumulus PHP-GD Banner

Posted: Fri Jul 05, 2013 1:42 am
by josecmorales
I downloaded the files from TNET, i modified teh banners.php, but doesnt shows, only show this
http://climaguayana.comuv.com/banners.php

can someone give a hand with this?

Grettings