David Dyer-Bennet <dd-> wrote in
news::
> "A. Sinan Unur" <> writes:
>
>> David Dyer-Bennet <dd-> wrote in
>> news::
>>
....
> Here you go. Note that this runs under mod_perl; my current best info
> suggests that the module Image::EXIF isn't compatible with mod_perl --
You might want to read
http://perl.apache.org/docs/1.0/guid...pache__Registr
y_secrets (
http://tinyurl.com/4f4a5)
Also, running under mod_perl may mean different things depending on
context. You should specify whether it is running as a so-called Registry
script.
> somewhere down in the underlying C utility code. I haven't chased it
> that deep.
I don't have time to either. I also don't have Image::EXIF on my system and
don't have time to compile it. However, does the following code help?
(untested).
#! /usr/bin/perl
# Untested
use strict;
use warnings;
use Data:

umper;
use Image::EXIF;
use CGI;
$CGI:

OST_MAX = 5000;
$CGI:

ISABLE_UPLOADS = 1;
use CGI::Carp 'fatalsToBrowser';
use File::Spec 'catfile';
use constant IMAGE_DIR =>
'/web/dd-b/SnapshotAlbum/data/2004/09180-Birthday';
run();
sub run {
my $q = new CGI;
my $fn = CGI->param('fn');
$fn = '' unless defined $fn;
# Always untaint variables ... see perldoc perlsec
if($fn =~ /^(\w+\.jpg)$/i) {
$fn = $1;
} else {
$fn = '';
}
$fn = catfile IMAGE_DIR, $fn;
die "Cannot read $fn: $!" unless -r $fn;
my @res;
push @res, "File: ", $fn;
my $exif = Image::EXIF->new;
$exif->file_name($fn);
push @res, $exif->error ? $exif->errstr : Dumper($exif->get_all_info);
print $q->header,
$q->start_html('test'),
$q->pre(join ("\n", @res)),
$q->end_html;
}
}
__END__