To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.org.ca.rtltorontoOpen lugnet.org.ca.rtltoronto in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Organizations / Canada / rtlToronto / 14387
14386  |  14388
Subject: 
Re: New LEGO RoboCam'Bot
Newsgroups: 
lugnet.org.ca.rtltoronto
Date: 
Wed, 24 Aug 2005 14:25:45 GMT
Viewed: 
844 times
  
On Wed, Aug 24, 2005 at 02:02:23PM +0000, David Koudys wrote:
Actually, just thinking about it--every 10 seconds the latest image gets FTP'd
to the server (and 10 seconds later gets overwritten with the new image).
Someone more intelligent than I could probably write a little .cgi that's
triggered by a button on the page that would take that file and copy and rename
it to another directory, for viewing purposes.

Any programmers wanting to take up the challenge?

Here ya go - plop this in your cgi-bin, and update the 3 configuration
lines, and you're all set.  To take a snapshot, just link to the CGI.

Ideally, it'll work - but I haven't actually tested it.

:)

Dan

--

#!/usr/bin/perl -wT

# *** STANDARD WARNING ***
# writing code in email without testing it is dangerous!
# don't use this code!

use strict;
uss File::Copy;

# Configuration

my $orig = "/path/to/original.jpg";  # picture you want to save
my $target = "/path/to/save/dir";    # directory to save snapshots
my $redirecturl = "http://example.com/some/page.html";
               # where to send people after they take the snapshot
# End configuration

my @time = localtime;
$time[4] ++;
$time[5] += 1900;
my $name = sprintf("%04d%02d%02d.%02d%02d%02d.$$.jpg", reverse @time[0..5]);
copy($orig, "$target/$name") or warn "Failed to copy to $target/$name: $!";

print "Status: 302 Moved\n";
print "Location: $redirecturl\n\n";
exit;


__END__

--
Dan Boger
dan@peeron.com



Message has 1 Reply:
  Re: New LEGO RoboCam'Bot
 
(...) Thanks Dan! That was very quick! I've implemented and changed approriate settings (fixed type-o as well) THe script does something--it runs and will redirect the user to the appropriate page, but it does not copy the file to the specified (...) (19 years ago, 24-Aug-05, to lugnet.org.ca.rtltoronto)

Message is in Reply To:
  Re: New LEGO RoboCam'Bot
 
(...) It's a great idea, but then there'd have to be some sort of button for 'take pic' on the page. If I knew more about, well, anything, I would set up a web applet for the webcam software to save a picture when a button on the page is pushed. But (...) (19 years ago, 24-Aug-05, to lugnet.org.ca.rtltoronto)

33 Messages in This Thread:










Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR