The script:
CPAN::Forum
Image-ExifTool - Re: IPTC issues...
| Posted on Fri Jun 9 19:51:09 2006 by exiftool in response to 2450 (See the whole thread of 4) |
| Re: IPTC issues... |
|
The script: #!/usr/bin/perl -w
BEGIN { push @INC, 'lib' }
use Image::ExifTool;
my $imgPath = shift;
$strInsert="";
$strFields="";
$strVals="";
my @ioTagList = qw(ObjectName DateCreated By-line By-lineTitle City Province-State
Country-PrimaryLocationName Headline Credit Source Caption-Abstract Writer-Editor
OriginalTransmissionReference Category);
my $exifTool = new Image::ExifTool;
$info = $exifTool->ImageInfo($imgPath, \@ioTagList, {Group => 'IPTC'});
foreach (sort keys %$info) {
my $val = $$info{$_};
if (ref $val eq 'ARRAY') {
$val = join(', ', @$val);
} elsif (ref $val eq 'SCALAR') {
$val = '(Binary data)';
}
$strFields = $strFields.$_.",";
$strVals = $strVals."'".$val."',";
$strInsert = "insert into table (".substr($strFields, 0, length($strFields)-1).") values
(".substr($strVals, 0, length($strVals)-1).")";
}
print "\n\n$strInsert\n";
$exifTool='';
# end
The terminal session: > ./ttt t/images/IPTC-XMP.jpg
insert into table (By-line,By-lineTitle,Caption-Abstract,Category (1),City (1),Country-PrimaryLocat
+ionName,Credit (1),DateCreated (1),Headline (1),ObjectName,OriginalTransmissionReference,Province-
+State,Source (1),Writer-Editor) values
('Phil Harvey','My Position','A witty caption','1','Kingston','Canada','My Credit','2004:02:26','No
+ headline','Test IPTC picture','What is a transmission reference','Ont','I'm the source','I wrote
+it')
No ApplicationRecordVersion tag, even though it does exist. Does your script work like this when run on t/images/IPTC-XMP.jpg ? |
| Write a response |
(4)
]