<?xml version="1.0" encoding="windows-1252"?>
<node id="52416" title="Re: Webcam 0.2" created="2001-01-16 22:45:14" updated="2005-07-30 11:35:26">
<type id="11">
note</type>
<author id="5993">
Beatnik</author>
<data>
<field name="doctext">
When Stamp started Coredumping on me, I hacked this piece of code. &lt;BR&gt;&lt;BR&gt;
&lt;CODE&gt;
#!/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 bottom

for(;;) {
$texttop = localtime;
$ltop = length($texttop)*8;
$lbot = length($textbot)*8;
$result = qx|cqcam -32+ -a+ -r -j -x 320 -y 240 -q 75 &gt; $inputfile|;
if ($result) { die $result; }
$image = GD::Image-&gt;newFromJpeg($inputfile);
$blue = $image-&gt;colorClosest(0,0,255);
$shadow = $image-&gt;colorClosest(128,128,128);
($width,$height) = $image-&gt;getBounds();
$w = $width/2;
$ttop = $w-($ltop/2);
$tbot = $w-($lbot/2);
$image-&gt;string(gdMediumBoldFont,$ttop+2,3,$texttop,$blue);
$image-&gt;string(gdMediumBoldFont,$ttop,1,$texttop,$shadow);
$image-&gt;string(gdMediumBoldFont,$tbot,($height-14),$textbot,$blue);
$image-&gt;string(gdMediumBoldFont,$tbot+2,($height-14)+2,$textbot,$shadow);
open(FILE,"&gt;$outputfile") || die $!;
print FILE $image-&gt;jpeg();
close(FILE);
$ftp = Net::FTP-&gt;new($hostname);
$ftp-&gt;login($username,$password);
$ftp-&gt;cwd($remotedir);
$ftp-&gt;put($outputfile,$remotefile);
$ftp-&gt;quit;
sleep($interval);
}
&lt;/CODE&gt;&lt;BR&gt;&lt;BR&gt;
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 &lt;A HREF="http://sourceforge.net/projects/stampl/"&gt;Sourceforge somewhere&lt;/A&gt;.&lt;BR&gt;
Ofcourse sleep() isnt really a clean way to do it, but I didnt felt like forking :)

&lt;BR&gt;&lt;BR&gt;Greetz&lt;BR&gt;
Beatnik&lt;BR&gt;
... Quidquid perl dictum sit, altum viditur.</field>
<field name="root_node">
21591</field>
<field name="parent_node">
21591</field>
</data>
</node>
