#!/usr/bin/perl
#-----------------------------------------------------------------------------
# ___ _ _ ___ _ _ _
# ___ / __|__ _ _ __ (_) | |__ _ _ ___/ __| __ _ _(_)_ __| |_(_)_ _ __ _
# / -_) (__/ _` | ' \ _ | '_ \ || | / -_)__ \/ _| '_| | '_ \ _| | ' \/ _` |
# \___|\___\__,_|_|_|_(_) |_.__/\_, | \___|___/\__|_| |_| .__/\__|_|_||_\__, |
# |__/ |_| |___/
#-----------------------------------------------------------------------------
# $Id: client-cam,v 1.1.1.1 2000/06/10 19:09:24 eric Exp $
#
# eCam - a smarter webcam
# Copyright (C) 2000 Eric Richardson
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# For information, contact eScripting:
# info@escripting.com
# http://escripting.com
#
# This script takes a picture, converts it to jpg, and prints out
# jpg data. It should be called like a regular image (ie.
).
#
#-----------------------------------------------------------------------------
use IO::Socket;
my $server = IO::Socket::INET->new(
LocalPort => 3141,
Type => SOCK_STREAM,
Listen => 10,
Reuse => 1,
);
while (my $socket = $server->accept) {
`vidtomem -f temp -s320x240 -z1/2`;
`imgcopy -fJFIF temp-00000.rgb temp.jpg`;
my $data;
open (IMG, "temp.jpg");
while (
) { $data .= $_; }
close IMG;
print $socket $data;
$socket->close;
}