Hi,
Please excuse my noobishness with perl modules etc.
I have a Linux hosted website. Here's what I've done.
FTP'd the uncompressed Image-ExifTool-9.13 folder (and subfolders) to the root of my site.
Created a simple shtml page that contains <!--#include virtual="/cgi-bin/exif.pl"-->
in the body.
Created /cgi-bin/exif.pl and chmod 755
#!/usr/bin/perl -w
print "Content-Type: text/html\n\n";
use lib '/Image-ExifTool-9.13/lib';
use Image::ExifTool;
my $exifTool = new Image::ExifTool;
my $info = $exifTool->ImageInfo('exif.JPG');
foreach (keys %$info) {
print "$_ => $$info{$_}\n";
}
Where have I gone wrong, and please don't just say everywhere. :-[
Any help will be much appreciated.
First, see if you can get the CGI script to work without ExifTool.
Then, try one step at a time. First just try adding your "use" statement to see if that works. If it doesn't you have a permission problem or can't access the directory for some reason.
Then if this works, your script should work provided that you format the output in HTML. Something as simple as this would do:
#!/usr/bin/perl -w
print "Content-Type: text/html\n\n";
use lib '/Image-ExifTool-9.13/lib';
use Image::ExifTool;
my $exifTool = new Image::ExifTool;
$exifTool->Options(Escape => 'HTML');
my $info = $exifTool->ImageInfo('exif.JPG');
print "<html><head></head><body><pre>\n";
foreach (keys %$info) {
print "$_ => $$info{$_}\n";
}
print "</pre></body></html>\n";
Edit: Added missing semicolon in code.
Many thanks for your prompt reply Phil. I'm sorted now.
It may help others if you explained what your problem was, and post your working cgi script.
- Phil
There's not a lot to add really. My problem was nothing to do with exiftool, just a silly path error pointing to the library due to using subdomains.
I tested with the code you posted (just needs a semicolon on the end of one print statement).
Great, thanks. I added the semicolon.
- Phil