You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
793 B

#!/usr/bin/perl
#
# $Id: image2.pl,v 1.2 2004/01/13 19:22:04 jeffo Exp $
#
# Source File: image.pl
require 'sitecfg.pl';
%CONTENT_TYPES=(
"gif" => "image/gif",
"jpg" => "image/jpeg",
"jpe" => "image/jpeg",
"jpeg" => "image/jpeg",
"avi" => "video/x-avi",
"mid" => "audio/x-midi",
"wav" => "audio/x-wav",
"rmi" => "audio/basic",
"avi" => "video/x-avi",
"other" => "text/html"
);
&app_initialize;
opendir (DIR, "$testgraphic");
@dots = readdir(DIR);
closedir DIR;
$imgfile = join($pathsep, $testgraphic, $FORM{'img'});
@filesegs = split(/./, $FORM{'img'});
$fext = $filesegs[$#filesegs];
print "Content-Type: $CONTENT_TYPES{$fext}\n\n";
open (IMGFILE, "<$imgfile");
binmode(IMGFILE);
$fsize = (stat(IMGFILE))[7];
read(IMGFILE, $img, $fsize);
close IMGFILE;
print $img;