Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Useful webcam code

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

Useful webcam code

Postby RCE » Sun Feb 28, 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: 2472
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Useful webcam code

Postby beteljuice » Sun Feb 28, 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 Dec 26, 2009 7:59 am
Weather Station: WH1080
Operating System: Vista
Location: Sheffield UK

Re: Useful webcam code

Postby RCE » Sun Feb 28, 2010 3:26 pm

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


Return to “Webcams”

Who is online

Users browsing this forum: No registered users and 1 guest