line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# mamgal - a program for creating static image galleries |
2
|
|
|
|
|
|
|
# Copyright 2009 Marcin Owsiany |
3
|
|
|
|
|
|
|
# See the README file for license information |
4
|
|
|
|
|
|
|
# A base class for the image info library wrappers. |
5
|
|
|
|
|
|
|
package App::MaMGal::ImageInfo::Base; |
6
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
64
|
|
7
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
63
|
|
8
|
3
|
|
|
3
|
|
13
|
use base 'App::MaMGal::Base'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
187
|
|
9
|
3
|
|
|
3
|
|
14
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1010
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init |
12
|
|
|
|
|
|
|
{ |
13
|
220
|
|
|
220
|
0
|
295
|
my $self = shift; |
14
|
220
|
100
|
|
|
|
562
|
my $file = shift or croak 'filename not provided'; |
15
|
218
|
|
|
|
|
643
|
$self->{info} = $self->get_info($file); |
16
|
216
|
|
|
|
|
847
|
$self->{file_name} = $file; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
0
|
0
|
0
|
sub get_info { croak "Missing implementation" } |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my %methods_to_tags = ( |
22
|
|
|
|
|
|
|
datetime_original_string => '0x9003', |
23
|
|
|
|
|
|
|
datetime_digitized_string => '0x9004', |
24
|
|
|
|
|
|
|
datetime_string => '0x0132', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub creation_time |
28
|
|
|
|
|
|
|
{ |
29
|
30
|
|
|
30
|
0
|
12796
|
my $self = shift; |
30
|
30
|
|
|
|
|
78
|
foreach my $type (qw(_original_ _digitized_ _)) { |
31
|
74
|
|
|
|
|
242
|
my $method = "datetime${type}string"; |
32
|
74
|
|
|
|
|
287
|
my $string = $self->$method; |
33
|
74
|
100
|
|
|
|
180
|
next unless $string; |
34
|
42
|
|
|
|
|
63
|
my $value = eval { $self->{parser}->parse($string); }; |
|
42
|
|
|
|
|
293
|
|
35
|
42
|
|
|
|
|
2564
|
my $e = $@; |
36
|
42
|
100
|
|
|
|
151
|
return $value if $value; |
37
|
22
|
100
|
|
|
|
60
|
if ($e) { |
38
|
2
|
|
|
|
|
6
|
chomp $e; |
39
|
2
|
|
|
|
|
27
|
$self->{logger}->log_message(sprintf('EXIF tag %s: %s', $methods_to_tags{$method}, $e), $self->{file_name}); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
10
|
|
|
|
|
30
|
return undef; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# EXIF v2.2 tag 0x9003 DateTimeOriginal |
46
|
|
|
|
|
|
|
# "when the original image data was generated" |
47
|
|
|
|
|
|
|
# |
48
|
|
|
|
|
|
|
# aka. Date/Time Original (exiftool output) |
49
|
|
|
|
|
|
|
# aka. DateTimeOriginal (Image::ExifTool::Exif) |
50
|
|
|
|
|
|
|
# aka. DateTimeOriginal (Image::Info, Image::TIFF) |
51
|
0
|
|
|
0
|
0
|
|
sub datetime_original_string { croak "Missing implementation" } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# EXIF v2.2 tag 0x9004 DateTimeDigitized |
54
|
|
|
|
|
|
|
# "when the image was stored as digital data" |
55
|
|
|
|
|
|
|
# |
56
|
|
|
|
|
|
|
# aka. Create Date (exiftool output) |
57
|
|
|
|
|
|
|
# aka. CreateDate (Image::ExifTool::Exif) |
58
|
|
|
|
|
|
|
# aka. DateTimeDigitized (Image::Info, Image::TIFF) |
59
|
0
|
|
|
0
|
0
|
|
sub datetime_digitized_string { croak "Missing implementation" } |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# EXIF v2.2 tag 0x0132 DateTime |
62
|
|
|
|
|
|
|
# "of image creation" |
63
|
|
|
|
|
|
|
# |
64
|
|
|
|
|
|
|
# aka. Modify Date (exiftool output) |
65
|
|
|
|
|
|
|
# aka. ModifyDate (Image::ExifTool::Exif) |
66
|
|
|
|
|
|
|
# aka. DateTime (Image::Info, Image::TIFF) |
67
|
0
|
|
|
0
|
0
|
|
sub datetime_string { croak "Missing implementation" } |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
0
|
|
sub description { croak "Missing implementation" } |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |