Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Image::EXIF troubles

Reply
Thread Tools

Image::EXIF troubles

 
 
David Dyer-Bennet
Guest
Posts: n/a
 
      11-14-2004
Anybody else using Image::EXIF to read exposure data and such out of
image files from digital cameras? Or is there some other module that
people like better for that?

I find its error reporting confusing or unreliable or something. I've
got a case where it doesn't read any data, but doesn't indicate
$exif->error() either; but this is under mod_perl, and *doesn't*
happen standalone, so it's probable running afoul of some restriction
there (and I've asked on the mod_perl mailing list, no responses
yet).
--
David Dyer-Bennet, <mailto:dd->, <http://www.dd-b.net/dd-b/>
RKBA: <http://noguns-nomoney.com/> <http://www.dd-b.net/carry/>
Pics: <http://dd-b.lighthunters.net/> <http://www.dd-b.net/dd-b/SnapshotAlbum/>
Dragaera/Steven Brust: <http://dragaera.info/>
 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      11-14-2004
David Dyer-Bennet <dd-> wrote in news::

> Anybody else using Image::EXIF to read exposure data and such out of
> image files from digital cameras? Or is there some other module that
> people like better for that?
>
> I find its error reporting confusing or unreliable or something. I've
> got a case where it doesn't read any data, but doesn't indicate
> $exif->error() either; but this is under mod_perl, and *doesn't*
> happen standalone, so it's probable running afoul of some restriction
> there (and I've asked on the mod_perl mailing list, no responses
> yet).


Please post a short but complete script that exhibits the problem you are
experiencing.

Sinan.
 
Reply With Quote
 
 
 
 
David Dyer-Bennet
Guest
Posts: n/a
 
      11-14-2004
"A. Sinan Unur" <> writes:

> David Dyer-Bennet <dd-> wrote in news::
>
>> Anybody else using Image::EXIF to read exposure data and such out of
>> image files from digital cameras? Or is there some other module that
>> people like better for that?
>>
>> I find its error reporting confusing or unreliable or something. I've
>> got a case where it doesn't read any data, but doesn't indicate
>> $exif->error() either; but this is under mod_perl, and *doesn't*
>> happen standalone, so it's probable running afoul of some restriction
>> there (and I've asked on the mod_perl mailing list, no responses
>> yet).

>
> Please post a short but complete script that exhibits the problem you are
> experiencing.


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 --
somewhere down in the underlying C utility code. I haven't chased it
that deep.

#! /usr/bin/perl

# Testing Testing Testing

use strict;
use warnings;

use Apache::Util;
use Image::EXIF;
use CGI;
use Data:umper;

use CGI::Carp 'fatalsToBrowser';
$CGI:OST_MAX = 5000;
$CGI:ISABLE_UPLOADS = 1;
my $q = new CGI;

my $dir = "/web/dd-b/SnapshotAlbum/data/2004/09180-Birthday";

my $fn = $dir . "/" . $q->param('fn');
die "No such file as $fn" unless -r $fn;

my @res = ();

push @res, "File: ", $fn;

my $exif = new Image::EXIF ();
$exif->file_name($fn);
push @res, $exif->error() ? $exif->errstr() : Dumper($exif->get_all_info);

print $q->header,
$q->start_html('test');
print $q->pre(join ("\n", @res));
print $q->end_html;

$exif = undef;
$q = undef;
@res = undef;


--
David Dyer-Bennet, <mailto:dd->, <http://www.dd-b.net/dd-b/>
RKBA: <http://noguns-nomoney.com/> <http://www.dd-b.net/carry/>
Pics: <http://dd-b.lighthunters.net/> <http://www.dd-b.net/dd-b/SnapshotAlbum/>
Dragaera/Steven Brust: <http://dragaera.info/>
 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      11-14-2004
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__

 
Reply With Quote
 
Martin Herrmann
Guest
Posts: n/a
 
      11-15-2004
David Dyer-Bennet <dd-> wrote in message news:<>...
> Anybody else using Image::EXIF to read exposure data and such out of
> image files from digital cameras? Or is there some other module that
> people like better for that?


Maybe you should try Image::MetaData::JPEG instead of Image::EXIF.
It's written in pure perl and works quite good in my Perl/Tk picture
viewer and organizer Mapivi (http://mapivi.de.vu).

Regards
Martin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wireless troubles =?Utf-8?B?VG9ueSBM?= Wireless Networking 4 11-03-2005 04:45 PM
Home Network Troubles using Windows XP Network Setup Wizard =?Utf-8?B?RHJlZA==?= Wireless Networking 6 08-05-2005 02:06 PM
Newsgroup password troubles Tony Raven Firefox 11 07-17-2004 07:34 AM
skin troubles sport0boy@netscape.net Firefox 0 12-29-2003 04:11 PM
Mozilla Mail troubles (newbie) Orlando Firefox 0 10-31-2003 01:44 PM



Advertisments