Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
When Stamp started Coredumping on me, I hacked this piece of code.

#!/usr/bin/perl use Net::FTP; use GD; # Beatnik (c) 2000 - yadayadayada # http://stampl.sourceforge.net $inputfile = "/tmp/me.jpg"; # Local input filename $outputfile = "/tmp/recent.jpg"; # Local output filename $remotefile = "recent.jpg"; # Remote filename $remotedir = ""; # Remote directory $hostname = "ftp.myhost.com"; # Remote hostname $username = "user"; # username for remote host $password = "password"; # password for remote host $interval = 45; # Amount of seconds to wait before uploading again $textbot = "StamPL - Test"; # The text that should be added at the bot +tom for(;;) { $texttop = localtime; $ltop = length($texttop)*8; $lbot = length($textbot)*8; $result = qx|cqcam -32+ -a+ -r -j -x 320 -y 240 -q 75 > $inputfile|; if ($result) { die $result; } $image = GD::Image->newFromJpeg($inputfile); $blue = $image->colorClosest(0,0,255); $shadow = $image->colorClosest(128,128,128); ($width,$height) = $image->getBounds(); $w = $width/2; $ttop = $w-($ltop/2); $tbot = $w-($lbot/2); $image->string(gdMediumBoldFont,$ttop+2,3,$texttop,$blue); $image->string(gdMediumBoldFont,$ttop,1,$texttop,$shadow); $image->string(gdMediumBoldFont,$tbot,($height-14),$textbot,$blue); $image->string(gdMediumBoldFont,$tbot+2,($height-14)+2,$textbot,$shado +w); open(FILE,">$outputfile") || die $!; print FILE $image->jpeg(); close(FILE); $ftp = Net::FTP->new($hostname); $ftp->login($username,$password); $ftp->cwd($remotedir); $ftp->put($outputfile,$remotefile); $ftp->quit; sleep($interval); }


It uses GD (which limits palette to 256 colors :( ) and Net::FTP. It also uses cqcam (which is also used by Stamp), and it currently on Sourceforge somewhere.
Ofcourse sleep() isnt really a clean way to do it, but I didnt felt like forking :)

Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.

In reply to Re: Webcam 0.2 by Beatnik
in thread Webcam 0.2 by Arjen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (16)
    As of 2015-07-31 16:17 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (279 votes), past polls