Sandaysoft

Support forum for Cumulus weather station software
It is currently Fri May 24, 2013 7:48 am
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 286 posts ]  Go to page Previous  1 ... 11, 12, 13, 14, 15, 16, 17 ... 20  Next
Author Message
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Sun Jan 22, 2012 8:39 pm 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
scramblers wrote:
My website programming skills leave a lot to be desired but using the template and instructions, I have successfully managed to produce a banner that I can use on the Cumulus forum.

However, when I tried to use it on other forums and as part of my normal Microsoft Outlook email signature it would not work. From reading this thread I believe that this is because they will not allow php scripts on their websites. I also understand that the banner can be output as a png, jpg or gif picture which then can be used.

Am I correct or have I mis-understood parts of the forum thread?


Many forums require that an image being included use an image formatted file. ie end in png, gif, jpg... while the banner script by default outputs data in png format, the filename itself has the ending php.

If your webhost allows for it, you can create what is called a mod_rewrite rule which will take a name like banner.png and have it passed on to a php script like banner.php

Example:
Code:
RewriteRule ^/?banner.png$ /banner.php [L]
RewriteRule ^/?banner2.png$ /banner2.php [L]
RewriteRule ^/?banner3.png$ /banner3.php [L]


In the examples above, I have defined 3 different images banner.png banner2.png and banner3.png which the apache web server will actually pass to banner.php, banner2.php and banner3.php respectively.

The rewrite rules would go into your .htaccess after the RewriteEngine On command.

This way, I can use banner.png in forums and other locations that only accept graphic image filename, but get the same effect.

My banner in this posting is actually pointing at a png filename not a PHP one as a perfect example of this.

Note, including a link like this in email may not work, not because the link is bad, but because email is static and it also elevates your email to look more like spam. Many (most) MUA's don't display images by default without asking for approval to do so as many spam sources uses links like that to confirm the spam they sent was received.

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Mon Jan 23, 2012 3:20 pm 
Offline
User avatar

Joined: Wed Jan 26, 2011 9:53 pm
Posts: 46
Location: Tamworth, Staffordshire
Weather Station: Davis VP2+ with daytime FARS
Operating System: Windows 7
Quote:
The rewrite rules would go into your .htaccess after the RewriteEngine On command.


I have used FileZilla Client to look for the .htaccess but I cannot find it in my root directory. I read somewhere in this forum that the dot prefix makes it invisible! How can I check whether it is there or not?

If there is no .htaccess can I just write one or can I copy and insert a 'standard' .htaccess? And if there is a standard .htaccess can a member please post it for me to copy?

So many questions and so little knowledge :? but I'm learning.

_________________
John

Image Image


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Mon Jan 23, 2012 3:27 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17589
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
If you look on the Server menu in Filezilla, you should see a 'force showing hidden files' option, so you would then be able to see .htaccess if you have one. If you don't then just create one with the rules that you want.

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Mon Jan 23, 2012 4:45 pm 
Offline
User avatar

Joined: Wed Jan 26, 2011 9:53 pm
Posts: 46
Location: Tamworth, Staffordshire
Weather Station: Davis VP2+ with daytime FARS
Operating System: Windows 7
steve wrote:
If you look on the Server menu in Filezilla, you should see a 'force showing hidden files' option, so you would then be able to see .htaccess if you have one. If you don't then just create one with the rules that you want.

I have ticked that option on FileZilla and I cannot see .htaccess.

My computing knowledge is scant, asking me to create a .htaccess is the same as asking me to write a sentence in urdu. My website and banner have been developed by adapting or modifying various bits of code from forum member's websites and banners as well as reading the various threads in this forum. I could not develop either from scratch (sad but true), I need a 'starter'. Could any member assist please?

_________________
John

Image Image


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Mon Jan 23, 2012 5:42 pm 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
I would be able to help later today. Send me a message via my Email address.

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Mon Jan 30, 2012 7:31 pm 
Offline

Joined: Sat Dec 31, 2011 12:18 am
Posts: 6
Location: Central USA
Weather Station: Davis VP2
Operating System: Win7 32bit
Stepping back to scamblers post about inserting the banner into email (Outlook 2010 - w/ HTML enabled).

Does the output need to be changed to a graphic format - on an email client? I am aware that not everyone will have graphics enabled and may not see it. How do you insert the code so it shows up and not the text pointing to the banner? My attempts so far have not worked. i.e. <a href=”http://mywebaddress.com”><img src=”http://mywebaddress.com/banner.php”/></a>

Sorry if I am being dense....!

_________________
John

Davis Vantage Pro2
Image


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Tue Jan 31, 2012 4:18 pm 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
I would highly recommend Not using this in your email. It is one of the fastest ways to get your email marked as spam or malicious. Having your email contain a link to a what the receiver of the email considered as an unknown source is not a good thing.

On top of that, the MUA doesn't see banner.php as a valid image as it is not an image file. It would need to be banner.png instead which would require the setup using mod_rewrite on your server as previously posted above.

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Tue Jan 31, 2012 7:55 pm 
Offline

Joined: Sat Dec 31, 2011 12:18 am
Posts: 6
Location: Central USA
Weather Station: Davis VP2
Operating System: Win7 32bit
Thanks Kevin!

_________________
John

Davis Vantage Pro2
Image


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Fri Feb 10, 2012 5:18 pm 
Offline

Joined: Sat Dec 31, 2011 12:18 am
Posts: 6
Location: Central USA
Weather Station: Davis VP2
Operating System: Win7 32bit
I have been modifying my banner and wanted to add the wind chill to it. It appears that I am missing something and maybe overlooking the obvious?

Temporary banner url (a different version than displays on my signature): http://elkhornwx.com/123test.html

banner.php code for item in question
$text = "Hum: " . ret_value("hum") . "% - " . "DewPt: " . ret_value("dew") . '°' . ret_value("tempunit") . " Wind Chill: " . ret_value("wchll") . '°' . ret_value("tempunit");
if ($SITE['usettf'] == "yes" ) {
$size = 10;
imagettftextbox($im, $size, 0, 0, 41, $black, $font4, $text, $SITE['image_width'], "center");

realtime .txt data from site:
10/02/12 10:14:55 13.5 71 5.8 14.0 15.0 335 0.00 0.00 30.383 NNW 4 mph F in in 109.8 +0.026 0.68 0.68 0.00 66.6 30 -2.0 +0.1 28.9 01:05 11.9 08:34 15.0 04:13 26.0 04:07 30.384 10:10 30.126 00:05 1.9.2 1026 23.0 13.5 13.5 0 0.000 0 336 0.00 1 1 0 NNW 1749 ft -0.4 0.0 360 0

My realtime.txt file appears o.k. so I don't see why the whindchill does not show?

_________________
John

Davis Vantage Pro2
Image


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Fri Feb 10, 2012 6:36 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17589
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
SpHwk wrote:
ret_value("wchll")


Should be

ret_value("wchill")

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Fri Feb 10, 2012 10:13 pm 
Offline

Joined: Sat Dec 31, 2011 12:18 am
Posts: 6
Location: Central USA
Weather Station: Davis VP2
Operating System: Win7 32bit
Thanks Steve!

I was getting the field name from the header info of the banner.php which had it listed as "wchll" - unless I unknowingly edited it.

Works greeat now...

_________________
John

Davis Vantage Pro2
Image


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Sat Feb 11, 2012 9:11 am 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2518
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
Err, are you sure John? The banner in your Sig is blank!

and now it isn't! :lol:

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Sat Feb 11, 2012 1:34 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1851
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
mcrossley wrote:
Err, are you sure John? The banner in your Sig is blank!

and now it isn't! :lol:
Won't be using the rename facility in ftp then ;)

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Tue Sep 25, 2012 11:08 am 
Offline

Joined: Thu Aug 23, 2012 8:53 pm
Posts: 42
Location: Konin, Poland
Weather Station: WH 2080
Operating System: Windows 7
Do you know maybe how to change the size of units in the script? I want to have smaller size only for wind units (the rest of the line "WIND: S # 23" I want to leave bigger).


Top
 Profile  
 
 Post subject: Re: Cumulus PHP-GD Banner
PostPosted: Tue Sep 25, 2012 2:19 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1851
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
For some reason the commented lines in your script are the wrong way round - ie. bearing should be windspeed.

Code:
// Print bearing
$text = "Wiatr: " . ret_value("wspeed") . ret_value("windunit");
if ($SITE['usettf'] == "yes" ) {
    $size = 10;
    imagettftextbox($im, $size, 0, 0, 22, $black, $font3, $text, $SITE['image_width'], "left");
} else {
    $size = 5;
    imageWriteString($im, $size, $text, $black, "left", 23);
}

// Print windspeed

$text = "-> " . ret_value("wdir");
if ($SITE['usettf'] == "yes" ) {
    $size = 10;
    imagettftextbox($im, $size, 0, 60, 37, $black, $font3, $text, $SITE['image_width'], "left");
} else {
    $size = 5;
    imageWriteString($im, $size, $text, $black, "left", 23);
}
As you probably realise, you are going to have to split the text string and play with the start position of the wind units string.

eg. windspeed (ttf fonts assumed)
Code:
// Print WINDSPEED
$text = "Wiatr: " . ret_value("wspeed");
if ($SITE['usettf'] == "yes" ) {
    $size = 10;
    imagettftextbox($im, $size, 0, 0, 22, $black, $font3, $text, $SITE['image_width'], "left");
    $text = ret_value("windunit");
    $size = 8; // new wind unit size
    imagettftextbox($im, $size, 0, 0, 42, $black, $font3, $text, $SITE['image_width'], "left");
// NB. start position 42 is a GUESS, leave enough room for an expected Max speed


} else {
    $size = 5;
    imageWriteString($im, $size, $text, $black, "left", 23);
}


_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 286 posts ]  Go to page Previous  1 ... 11, 12, 13, 14, 15, 16, 17 ... 20  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group