Subject:
|
Re: New LEGO RoboCam'Bot
|
Newsgroups:
|
lugnet.org.ca.rtltoronto
|
Date:
|
Wed, 24 Aug 2005 14:43:14 GMT
|
Viewed:
|
932 times
|
| |
| |
In lugnet.org.ca.rtltoronto, Dan Boger wrote:
> 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__
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 directory. I've tried
absolute paths in the configuration, as well as './' and '../' None seem to get
the file copied over.
I do appreciate your help and I'll try again later, but right now I have to go
pick up a very attractive woman and go on vacation.
So play around iwththe 'bot and let me know what else I could do to make the
experience a better one.
Dave K
|
|
Message has 1 Reply: | | Re: New LEGO RoboCam'Bot
|
| (...) Stupid typos :) (...) Does the webserver use have permissions to write to the targetted directory? Absolut path is the right way to go. Anything in the error log? (...) My god, why did you even bother replying?!? Git! (19 years ago, 24-Aug-05, to lugnet.org.ca.rtltoronto)
|
Message is in Reply To:
| | Re: New LEGO RoboCam'Bot
|
| (...) 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 (...) (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
|
|
|
|