Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3044 7 December 2018. See the Wiki for download

Useful webcam code

Hardware/software/hints and tips/discussion/webcam links etc
Post Reply
User avatar
RCE
Posts: 106
Joined: Sat 26 Dec 2009 7:59 am
Weather Station: WH1080
Operating System: Vista
Location: Sheffield UK

Useful webcam code

Post by RCE » Sun 28 Feb 2010 10:25 am

I wanted my weather cam to show more of the weather conditions, and less of the surrounding area. This meant physically turning the webcam into portrait mode, of course the saved images are still displayed in landscape so image is laid on it's side.

Found a javascript utility that manipulates the images http://www.swfir.com/ browser needs to be flash enabled.

Demo of it working at http://www.imagezoom.co.uk/weather/viewcam.htm (note this demo site is only updated once per day).
====
Alan

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Useful webcam code

Post by beteljuice » Sun 28 Feb 2010 12:28 pm

Does your server support php ?

Assuming a .jpg picture source:
cam.php

Code: Select all

<?php
// cam.php
// File and rotation
$filename = 'test.jpg';
$degrees = 90; // anticlockwise or -90 or 270 for clockwise

// Content type
header('Content-type: image/jpeg');

// Load
$source = imagecreatefromjpeg($filename);

// Rotate
$rotate = imagerotate($source, $degrees, 0);

// Output
imagejpeg($rotate);

imagedestroy($source);
imagedestroy($rotate);
?> 
In your html the code becomes <img src="cam.php" .... etc. />
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
RCE
Posts: 106
Joined: Sat 26 Dec 2009 7:59 am
Weather Station: WH1080
Operating System: Vista
Location: Sheffield UK

Re: Useful webcam code

Post by RCE » Sun 28 Feb 2010 3:26 pm

No, thanks anyway code may be useful for someone.
====
Alan

Post Reply