New Script: Text Overlay Web Cam Image from PHP Weather-Display tags

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


$text1 = '';

to


# 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/', '

Good one :thumbright:

Very cool, Mike! :D/ =D> :greenjumpers:

Congratulations on starting your own “scriptorium”!

Best regards,
Ken

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

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

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.

It would be really nice if it was possible to archive the overlaid images at intervals :wink: (Then I could use it :smiley: )

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 …

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

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.

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?

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…

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!!!

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.

Yes I am using 1.30, have down loaded the latest, will try 1.60 tomorrow :smiley:

Update, I had a spare 5 mins, yes thats done the trick MCHALLIS :smiley:

Oh, It needs a cron job? I can’t do that on my setup. So if it is just me asking please don’t work on it.

Thanks anyway.

Anyway with the text overlay cam php script I am getting a error
Warning: chmod() [function.chmod]: Operation not permitted in “mypath”/imagecam.php on line 539

But if I hit refresh again the error goes away. It happens when the webcam updates. Any ideas what is up?

Thanks

Tony

Anthony,

We cannot schedule cron jobs on E-Rice, but I use a program named System Scheduler that will do the same thing by calling the PHP script at times that I schedule. Same difference really. The script for uploading to weather underground from the server will be very interesting!

  • Jim

Ok…Well I am up for it then if you are also. (you will have to help me hehe)

I am working on a wunderground image upload by PHP tutorial right now. :lol:

fox,
The chmod is so the new image file created can be world readable. I thought some servers might have different default permission settings that make the file not world readable. It looks like some severs may not be setup to support the chmod feature from a PHP script so I can disable that, maybe make it a feature that can be enabled if needed instead of enabled by default. I will put that feature in the next release maybe tonight.

fox,

I fixed the bug you had with chmod.

Version: 1.70 08-Jan-2008 - Bug fix for chmod error: Operation not permitted on some servers. added feature: setting to chmod images, disabled by default as most servers do not need it. added feature: setting to suppress output for cron job or System Scheduler usage, more compatible for web cam text overlay. added feature: setting for cached image file name, was previously automatic.

The script has it’s own page now …
http://www.642weather.com/weather/scripts-image-handler.php#ImageHandler