Setting up your Website and Webcam

Sounds good to me :slight_smile: If you want to add weather data on the website pic you can use the 642weather.com php script.

It’s to be found here: http://www.642weather.com/weather/scripts-image-handler.php the author, Mike Challis, has good documentation, it installs/runs on your webserver. It gets the weather data from a file uploaded by WD (I believe the linux version will do that part).

Not sure of the context but on here it normally means a movie generated from multiple snapshot images, IOW a time lapse, nice to show development of storms, dawn, sunset etc. Scroll to the bottom of the author’s page for examples http://www.weather-display.com/windy/gb/grahamsbeach.htm.

its not all that clear exactly what you are trying to do?
if you are simply wanting to upload a web cam image file to your web site
then use the
control panel, ftp/internet setup, web cam
select the file
click add to add to the list
then tick upload these files as well
set the times to upload
and turn the switch on

I just tested that here, and it works

I sent you my latest answers. Are you going to move those messages out here?

Randy

BTW, I tried putting a sticker in my signature, but it’s not coming through. I really want something like Brian has. Do you know how I create one of those?

Randy

Here’s the code for mine, just substitute your url and image url:

[url=http://www.realweatherstation.com]
[img]http://www.realweatherstation.com/wxs/sticker.php?type=banner[/img]
[/url]

Got it! Thanks.

Randy

Setting up your own weather website using WD for Linux.

Warning: WD is a very powerful piece of software and can do almost anything you want it to do. However, in my opinion, it is haphazardly organised (not a criticism, just an observation) and poorly documented (this has traditionally been one of the downsides of Linux projects). This means that if you are a beginner or an intermediate in Linux, you are likely to spend a helluva lot of time just finding out how things are supposed to work - at least that was my experience. This tutorial is my attempt to be part of the solution and not part of the problem.

Here are the things I wish I knew before I started the project.

a) WD is powerful and can do what you want…if you can find out how.
b) There are far fewer commenters on these forums than you would hope - so help is not always at hand.
c) You need to set up a static file somewhere called something like image.jpg. This will be a static file and to this name, you will post your webcam shots. This static file will then be uploaded on a regular basis (set by you) to your website and to WeatherUnderground (if you so wish). You will have to point WD and WU at this file.
d) There does not seem to be a program in Linux which can take webcam pictures at regular intervals and post them to a static file name. Work arounds are required.
e) Whatever solution you come up with, it will not be elegant. HT niko :slight_smile:

  1. Get yourself a website e.g www.xxxweatherxxx.xxx
  2. You can get this from GoDaddy. I have stolen the following from various posts by niko.

Following (and stealing from Bob), Creating a basic web page FAQ

Where Bob’s FTP/Internet set up is for Windows…the attached is mine for Linux.

Follow Bob’s instructions and fill out this page. Note there are duplicate numbers on Bob’s page…focus on the blue numbers that have arrows attached…ignore the ones with no arrows.

My generation time window is shown attached…again follow Bob’s lead…but ignore again the blue numbers with no arrows.

Now you will be taken to 3 web page set up forms. As each of these posts has a maximum of only 4 attachments, I will to the next post to show my 3 forms.


Ooops! for some reason my internet set up page was not loaded above. Here it is now.


Here are 2 of the 3 set up pages (max upload for all attachments is <200k…so, sorry will have to attach the third on to the next post). Note the first page of your website must be called index in e-rice. WD produces a file called index if you call your website index as in the attached screenshot. If your first page is not called index, then your information will not load.


Here is page 3.


Next we have the summary image page and icons etc.


Next we will tackle the webcam.

Niko says in one of the posts that setting up the WD component of the website i.e. the data was straightforward, my experience is that, yes in hindsight it is …but it was far from obvious and straightforward at the time…and I think that had to do with lack of documentation and leads…hopefully this tutorial will go some small way to remedying that.

My biggest problems were a) working out that you needed a static file name that WD and WU could link to b) finding a way of creating a static file name c) having a tick in the wrong place in one of the innumerable boxes on the webcam form stopping my jpg from loading.

Setting up the camera, for me, came in two parts.

  1. setting it up to connect to my website

  2. setting it up to connect to Weather Underground.

Regarding 2, here is a post from jloflin

OK, I’m going to try to piece this together. It took me many months of fiddling with settings. First, are you capturing images to your /wdisplay/downloads/ directory? That was my first problem, figuring out how to get my webcam to send images to that directory every minute. Then I made sure the images were named “snapshot.jpg”

Next, I opened control panel. Under “Web Site Configurations” I opened Web Cam. I clicked on “Load/Set Webcam Image File” and went to the /wdisplay/downloads/ directory and chose “snapshot.jpg”. Then I closed the Web Cam panel, using the check button.

Then I opened FTP & Connections. Under the Webcam tab, I clicked the “choose webcam file” button and navigated to and chose the “snapshot.jpg” file. Then I clicked the add button. I then closed the FTP & Connections panel, using the check button.

Next, under the “Station Settings” heading, I clicked on “Summary Images & Icons”. Under the “Use Webcam for Icon” I checked “Use the Webcam Image as the Icon”, “Show on Main” and “Stretch to Fit”. In the “Select Webcam Image to Use”, I clicked on the “Select Webcam Image to Use” button, navigated to “snapshot.jpg” and selected it. Then I clicked the “Use this Filename” button. I then closed the window with the check button.

Viola, within about 5 minutes, I had my webcam image as the icon on my main page.

I hope this helps. If you need, I can try to send you some screenshots of the windows and tabs I used. The only Webpage I’m uploading to at present is Weather underground page for my station at zip code 79912. I’m almost afraid to begin the effort to upload to a personal web page.

The snapshot.jpg is downloaded to my computer by the webcam’s control program (I use a panasonic camera and its embedded control software). It downloads once per minute, replacing the old file with a new one. One of the options in the control software is to just replace the file, and not to number them. Wdisplay just takes the file that it finds.

I’m uploading to Weather Underground the same snapshot.jpg that Wdisplay is using, but at 5 minute intervals. I chose the ftp method, and complete all the information requested on Weather Underground. It then gave me a camera name. In Wdisplay, under “Control Panel”, click on the Weather Underground icon. On the Weather Underground panel, click on the button to set up webcam uploads. In the FTP settings, the username is the name of your camera on weather underground, not your login name. Mine is randyloflinCAM2. The password is the same as your login password. The image file is the same one you use on your main page, mine is /wdisplay/downloads/snapshot.jpg. Select your upload times, turn the red button green and check the save button, close control panel with the save button, and you should be good to go. Now when I look in /wdisplay/downloads/, there is a wunderground.jpg file, which I presume is the one wdisplay is FTP’ing to weather underground.

  1. Go Control Panel > Web Cam
  2. concentrate on page 1 web cam set up…ignore all other pages…all you need worry about is your static file name and location. Don’t waste time on time stamping etc.
  3. see attached for how my set up looks. I had to crop it as the file was too big to upload…but I think you get the message. If you are linked correctly to your static file (set the webcam file image), the picture should show here. My static file image is called image-1.jpg.

Next you have to go to the FTP & Connections (that is what it is called on the Control Panel) thought the title of the window is FTP/Internet set up. This is the kind of thing that drives me crazy…lack of internal consistency…and different parts in different places…something this bitty needs some kind of trail…otherwise, newbies spend inordinate amounts of time trying to piece things together…and often just give up in frustration.

Here is my WebCam/FTP set up. I had accidentally ticked the box “use this remote directory instead” and spend days of frustration wondering why my jpg would not upload.


My experience with trying to get the jpg to upload to WU was equally frustrating via FTP. There are two options for loading a webcam image on to WU (and WU in the webcam area is far from a paragon of virtue when it comes to simplicity of instructions) one via FTP and one via your website URL …where they scrape the jpg from your website. I tried the FTP, could never get it to work (but see above) and then tried the URL and got that to work. Finding our where the kept the image after they uploaded them on to WU was another saga. You have to go to the camera set up page and click on the name of your webcam…sheeesh!

OK, so now we were able to upload a static image (and at this stage it was very static) to the website and to WU. The next problem was how to get an image every hour from my webcam and get that to remain named image-1.jpg. The only serious webcam software I could find on Ubuntu was guvcview. This was capable of taking images at set intervals; however, each time it took an image it incrmented the file name by 1. So I had image-2.jpg…image-19.jpg etc. At this stage I was mostly using the command line to get the image.

$ guvcview -i /home/pj-weather/Pictures/Webcam/image-1.jpg -m 1 -c 20

and this worked OK…but it meant that the program video was open the whole time, hogging resources etc.

I decided the most elegant way (hi niko! - blush) was to set up some kind of a cron file which would delete the old image-1.jpg and renmae image-x.jpg as the new image-1.jpg. I tried crontab and that did not realy work for me…the problem, and this took some time to solve was to do with where guvcview was outputting the video - see later.

To cut a long story short, I got a lot of help from the developer(Paulo Assis - thanks Paulo) of guvcview and from others on the Ubuntu forums.

I set up a script in /etc/cron.hourly…this will run any scripts in the folder automatically every hour.

Here is my script (apologies for the inelegance :slight_smile: )


#!/bin/sh
#This is a script which will a) detlete all incidences of image*.* from the webcam file
# and will then start guvcview and get it to take a single photo.
# 

PATH=/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

export DISPLAY=:0



rm /home/pj-weather/Pictures/Webcam/image-1.jpg


guvcview -i /home/pj-weather/Pictures/Webcam/image-1.jpg -m 1 -c 20 --exit_on_close



mv /home/pj-weather/Pictures/Webcam/image* /home/pj-weather/Pictures/Webcam/image-1.jpg




exit 0



Here are a number of posts from Paulo
Hi,
Since every time you change the filename the file counter resets, your best option at the moment is to have guvcview run twice and capture two different files.

e.g. add the following to a script that runs every hour:

guvcview - i /xxx/xxx/xxx/image.jpg -m 1 -c 20 --exit_on_close --no_display
guvcview -i /xxx/xxx/xxx/image2.jpg -m 1 -c 20 --exit_on_close --no_display

this should always create the same two files:
image-1.jpg and image2-1.jpg

Regards,
Paulo

Hi,

create a file name image_capture.sh and add the following content:

#!/bin/bash
TIME=$(date ‘+%H%M%S’)
guvcview -i image_$TIME.jpg -m 1 -c 20 --exit_on_close --no_display
mv image_$TIME-1.jpg image.jpg

Then set this script executable:
chmod +x image_capture.sh

you should then be able to add it to the cron tab and run it in a hour basis.
Since the filename will change every time the script runs the file counter will always reset.

Regards,
Paulo

Hi, For Ubuntu 11.04 you can download version 1.5.0 binary deb
directly, or add my ppa to you repository list:

deb:
http://prdownload.berlios.de/guvcview/guvcview_1.5.0_i386.deb

ppa:
sudo add-apt-repository ppa:pj-assis/ppa
sudo apt-get update
sudo apt-get install guvcview

as for the display you need to allow other users (like root) to export
their displays, for this you just need to run “xhost +local:” as your
current user or for a more permanent solution, create a script named
for instance xauthority.sh in /etc/profile.d with the following
content:

#!/bin/bash

Allow local users access to default display unless it’s owned by root

if [ ! “id -u” = “0” ]; then
export XAUTHORITY=/home/$LOGNAME/.Xauthority
export DISPLAY=:0.0
fi

I’ve tried this and it is working fine from the cron tab (just add the
“export DISPLAY=:0” line on the script), the file image is created as
root with read permissions for all.

Regards,
Paulo

Bahh! the xauthority script is wrong, this is the correct one:

#!/bin/bash

Allow local users access to default display unless it’s owned by root

if [ ! “id -u” = “0” ]; then
xhost +local:
export DISPLAY=:0.0
fi

Sorry,
Regards,
Paulo

My website and WU site now work the way I want.

I was hoping to go on to use some of the more elegant templates on my website (the WD is all very wll…but elegant it is not!), but getting this far has taken so much time that I think will until somebody else writes a “how to”

Done! Thanks.

Anybody know how to set up a visit counter on the website?