Weather-Watch.com
February 09, 2010, 12:17:06 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Members: 9,224  Posts: 342,204  Topics: 37,971
Please welcome clubber1966, our newest member.

Latest versions: WD - 10.37P  WDL - 6.05  MML - 1.03
 News:
Check out the new FAQs (Frequently Asked Questions) board for a growing list of hints, tips and diagnostic suggestions.
  Advanced Search
   Home   Bug Tracker Photo Gallery Wiki Chat Calendar Search Login Register Help  
Pages: [1] 2 3 ... 6
  Print  |  « previous  |  next »  |  Go Down  
Author Topic: New Script: Text Overlay Web Cam Image from PHP Weather-Display tags  (Read 21775 times)
0 Members and 1 Guest are viewing this topic.
MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,967
Local Time: Tuesday 06:17



WWW
« on: January 07, 2008, 03:08:24 AM »

You can use my new Multifunction Image Handler PHP Script as a Webcam Text Overlay PHP Script

Here is how to use it to overlay text from your weather data

Step 1) Install Ken True's PHP Weather-Display tags feature
http://saratoga-weather.org/scripts.php#PHPtags
Configure WD to upload the testtags.php to your web server every 5 minutes.
The testtags.php will have the weather variables you can use on your web cam overlay text
If you are already using the Weather Display/PHP/AJAX Website Template Set then you can skip this step.

Step 2) Install my Multifunction Image Handler PHP Script
http://www.642weather.com/weather/scripts.php
Just download the file, adjust a few settings at the top, upload it to your web server, and link to the file like you would an image. Please refer to the "How to use it" section at the top of the script source code for all the details.
Make sure step 2 is working, then continue to step 3.

Step 3) Edit the Multifunction Image Handler PHP Script file
In the settings section at the top make this simple change ...

change

Code:
$text1 = '';

to

Code:
# Relative path to your testtags.php file, Not the URL. (use ./testtags.php if it is in the same directory.)
require "./testtags.php";
$timezone = date('T');
$temperature = preg_replace('/°F/', ' °F', $temperature);

$text1 = "$time $timezone $date
$temperature, Rain:$dayrn, Wind:$avgspd, Max Gust:$maxgst
$current_summary
Long Beach, WA
www.642weather.com";

Use double quotes for the php variables to display.
The text can be a single line or multiple lines. If the line is too long it will auto wrap.
You can modify the text to your liking and use any data variables you want from the testtags.php file

See a live demo of it here:
Demo - Multifunction Image Handler
http://www.642weather.com/weather/scripts-image-handler.php#IHdemo

New Tutorials online:

PHP Web Cam Image Text Overlay Tutorial by Mike Challis
http://www.642weather.com/weather/scripts-weather-cam-text.php

How To PHP Upload Your Web Cam Image to WeatherUnderground
http://www.642weather.com/weather/scripts-weather-cam-uploader.php
« Last Edit: December 17, 2008, 04:38:31 AM by MCHALLIS » Logged

niko
syzygy
Junior Climate Controller
**
Offline Offline

Location: Northern California, U.S.A.
Station Type: 2 x Davis VP2 Wireless / Win 2000
Posts: 17,555
Local Time: Tuesday 05:17


WWW
« Reply #1 on: January 07, 2008, 03:12:37 AM »

Good one thumbright
Logged

ktrue
Junior Weather Controller
****
Offline Offline

Location: Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
Station Type: Davis VP1+ FARS, Boltek-PCI, NexStorm StormVue WASP2, GRLevel3, WXSIM
Posts: 3,616
Local Time: Tuesday 04:17



WWW
« Reply #2 on: January 07, 2008, 06:42:52 AM »

Very cool, Mike!   Very Happy/ Applause greenjumpers

Congratulations on starting your own "scriptorium"!

Best regards,
Ken
Logged

Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates
smokie
Senior Forecaster
*
Offline Offline

Location: Newquay, Cornwall UK
Station Type: WS2300, Weather display, WDL
Posts: 231
Local Time: Tuesday 13:17


WS2300 operational May 2007


WWW
« Reply #3 on: January 08, 2008, 02:46:46 PM »

Hi, cool script, good job, one thing I must be missing something becasue altering the $textalign to any of the other options has no effect, the overlay still appears top left, any ideas, works great apart from that.



* image-sky-cache.jpg (46.39 KB, 352x288 - viewed 360 times.)
« Last Edit: January 08, 2008, 02:48:43 PM by smokie » Logged


Newquay, Cornwall.UK  > WS2300 Operational since May 2007.
From 6/4/08 www.newquayweather.com
MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,967
Local Time: Tuesday 06:17



WWW
« Reply #4 on: January 08, 2008, 03:39:27 PM »

smokie,

What version of my script are you using?
version 1.3 had the bug you describe.
If you view the source it says what version at the top
Please download the latest version from today, that should fix it

Download the latest version here:
http://www.642weather.com/weather/scripts/multifunction-image-handler.php?sce=view

# Version: 1.30 07-Jan-2008 - Bug fix for wordwrap true type font text
# Version: 1.40 07-Jan-2008 - Bug fix for text position, not working on vers. 1.30
# Version: 1.50 07-Jan-2008 - Better handling of downloaded file name for local file
# Version: 1.60 08-Jan-2008 - Bug fix for true type fonts, bug fix for local file usage
« Last Edit: December 17, 2008, 04:38:56 AM by MCHALLIS » Logged

MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,967
Local Time: Tuesday 06:17



WWW
« Reply #5 on: January 08, 2008, 04:07:23 PM »

I am now using this PHP script to generate my web cam image every 5 minutes.

http://www.642weather.com/weather/cam.php

I used to manage the text overlay using WD webcamcapture.exe on my WinXP computer.
That method works pretty good, but the reason I do it now with PHP on my web server is to have better control of the text overlay since I already have weather information on my server using Ken True's PHP Weather-Display tags feature.
I still use WD webcamcapture.exe to send the plain image to my web server every 5 minutes, them my php script overlays text on it.

I even figured out a way to upload my web cam image to weather underground from my server using a PHP script I wrote.
If anybody wants to know exactly how I do it, let me know, I could write a "how to" article on my web site.
« Last Edit: December 17, 2008, 04:39:13 AM by MCHALLIS » Logged

niko
syzygy
Junior Climate Controller
**
Offline Offline

Location: Northern California, U.S.A.
Station Type: 2 x Davis VP2 Wireless / Win 2000
Posts: 17,555
Local Time: Tuesday 05:17


WWW
« Reply #6 on: January 08, 2008, 04:17:37 PM »

It would be really nice if it was possible to archive the overlaid images at intervals  Wink (Then I could use it  Very Happy )
Logged

MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,967
Local Time: Tuesday 06:17



WWW
« Reply #7 on: January 08, 2008, 04:35:39 PM »

It would be really nice if it was possible to archive the overlaid images at intervals  Wink (Then I could use it  Very Happy )

It is possible, I have a cronjob running on my server every 5 minutes to generate the text overlay. I use my image handler slightly modified to do that. It would be easy to put a few lines in there as an option to archive the images. The images would be on the web server, is that what you would like? How would you like the images to be timestamped?

I guess I would only do it if someone will actually use it, let me know ...
Logged

jmcmurry
Jim McMurry
Rain Maker
***
Offline Offline

Location: Mauston, WI, USA
Station Type: Davis Vantage Pro 2 Plus Wireless. StartWatch, VirtualVP, Boltek/NexStorm, GR3 & WxSim
Posts: 1,595
Local Time: Tuesday 07:17



WWW
« Reply #8 on: January 08, 2008, 05:09:49 PM »

It would be really nice if it was possible to archive the overlaid images at intervals  Wink (Then I could use it  Very Happy )

I can see how this would be handy for a lot of folks.  I have a similar system running that takes a new photo that's been uploaded, adds an overlay that was previously uploaded by WD, then maintains the last 96 webcam photos.  Then my slideshow script can show a sequence.  I do this with my Wasp2 images too.  I've been thinking about incorporating your new script because of the nice crisp overlay, but haven't gotten to it yet.

- Jim
Logged


 Home of NSLog NexStorm Lightning Data Manager
niko
syzygy
Junior Climate Controller
**
Offline Offline

Location: Northern California, U.S.A.
Station Type: 2 x Davis VP2 Wireless / Win 2000
Posts: 17,555
Local Time: Tuesday 05:17


WWW
« Reply #9 on: January 08, 2008, 05:33:23 PM »

It is possible, I have a cronjob running on my server every 5 minutes to generate the text overlay. I use my image handler slightly modified to do that. It would be easy to put a few lines in there as an option to archive the images. The images would be on the web server, is that what you would like? How would you like the images to be timestamped?

I guess I would only do it if someone will actually use it, let me know ...

Currently mine is similar to Jim's. One pic is stored each hour, the filename is imagehh.jpg e.g. image06.jpg so today's "06" replaces yesterday's "06" and the website just displays the current (frequently updated) image and image06 through image20 - which is a very simple html page. I doubt anyone else would want exactly that scheme, and a .php page can surely handle something more complex.
Logged

MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,967
Local Time: Tuesday 06:17



WWW
« Reply #10 on: January 08, 2008, 05:37:48 PM »

niko, I can write a separate cron job PHP script to do that, it is way simple.
Are you able to schedule a cron job on your web server?

« Last Edit: December 17, 2008, 04:39:30 AM by MCHALLIS » Logged

niko
syzygy
Junior Climate Controller
**
Offline Offline

Location: Northern California, U.S.A.
Station Type: 2 x Davis VP2 Wireless / Win 2000
Posts: 17,555
Local Time: Tuesday 05:17


WWW
« Reply #11 on: January 08, 2008, 05:50:14 PM »

niko, I can write a separate cron job PHP script to do that, it is way simple.
Are you able to schedule a cron job on your web server?

Crontab how to
http://www.crontabrocks.org/


No, I can't cron so don't do anything specifically for me, only put your time into this if it's a general interest thing. I think I could work around it with pseudo-chron though...
Logged

Fox_Of_The_Wind
Anthony
Weather Guru
**
Offline Offline

Location: De Soto Wisconsin USA
Station Type: Wireless davis vantage pro II Windows XP
Posts: 945
Local Time: Tuesday 06:17


C:\DOS C:\DOS\RUN RUN\DOS\RUN


WWW
« Reply #12 on: January 08, 2008, 07:52:02 PM »

I am now using this PHP script to generate my web cam image every 5 minutes.

http://www.carmosaic.com/weather/cam.php

I used to manage the text overlay using WD webcamcapture.exe on my WinXP computer.
That method works pretty good, but the reason I do it now with PHP on my web server is to have better control of the text overlay since I already have weather information on my server using Ken True's PHP Weather-Display tags feature.
I still use WD webcamcapture.exe to send the plain image to my web server every 5 minutes, them my php script overlays text on it.

I even figured out a way to upload my web cam image to weather underground from my server using a PHP script I wrote.
If anybody wants to know exactly how I do it, let me know, I could write a "how to" article on my web site.
Well I would like to say good job on the script. If I can get it running anyone can. LOL
Anyway I would like to find out how you made the php script for the weather underground. Thanks!!!!
Logged


MCHALLIS
Rain Maker
***
Offline Offline

Location: Long Beach, WA USA
Station Type: Davis VP2+
Posts: 1,967
Local Time: Tuesday 06:17



WWW
« Reply #13 on: January 08, 2008, 08:32:55 PM »

I will make a tutorial on my site for how I did the weather underground PHP upload. The script is very simple, but you have to be able to schedule a cron job on your web server. Give me a day or so to work on it.
Logged

smokie
Senior Forecaster
*
Offline Offline

Location: Newquay, Cornwall UK
Station Type: WS2300, Weather display, WDL
Posts: 231
Local Time: Tuesday 13:17


WS2300 operational May 2007


WWW
« Reply #14 on: January 08, 2008, 08:34:03 PM »

smokie,

What version of my script are you using?
version 1.3 had the bug you describe.
If you view the source it says what version at the top
Please download the latest version from today, that should fix it

Download the latest version here:
http://www.carmosaic.com/weather/scripts/multifunction-image-handler.php?sce=view

# Version: 1.30 07-Jan-2008 - Bug fix for wordwrap true type font text
# Version: 1.40 07-Jan-2008 - Bug fix for text position, not working on vers. 1.30
# Version: 1.50 07-Jan-2008 - Better handling of downloaded file name for local file
# Version: 1.60 08-Jan-2008 - Bug fix for true type fonts, bug fix for local file usage

Yes I am using 1.30, have down loaded the latest, will try 1.60 tomorrow Very Happy

Update, I had a spare 5 mins, yes thats done the trick MCHALLIS Very Happy
« Last Edit: January 08, 2008, 09:19:52 PM by smokie » Logged


Newquay, Cornwall.UK  > WS2300 Operational since May 2007.
From 6/4/08 www.newquayweather.com
Pages: [1] 2 3 ... 6
  Print  |  « previous  |  next »  |  Go Up  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!