ultranerds has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm trying to get the "creation date" of an image:

http://ultradev.com.nmsrv.com/nova-1.jpg

Now, I have this code:
#!/usr/bin/perl print qq|Content-Type: text/html \n\n|; use Image::IPTCInfo; my $file = '/home/www/images/test/nova-1.jpg'; my $k = Image::IPTCInfo->new( $file ); # || die Im +age::IPTCInfo::Error(); # my $info = new Image::IPTCInfo('file-name-here.jp +g'); # Check if file had IPTC data unless (defined($k)) { die Image::IPTCInfo::Erro +r(); } print "DATE WAS: " . $k->Attribute( 'date created' + ); print "END";

..which is using this module:

http://search.cpan.org/dist/Image-IPTCInfo/IPTCInfo.pm

The only problem, is it never seems to find the right date :/

If I right click that file on Vista, then click "Properties", and then "Details" - it shows the date fine - Date Taken: 14/07/2004 03:24

Can anyone suggest why its not working as I'm expecting? I just keep getting this error:

user@server1 admin $ perl test.cgi
Content-Type: text/html

No IPTC data found. at test.cgi line 13.


TIA!

Andy

Replies are listed 'Best First'.
Re: Image::IPTCInfo doesn't seem to work :/
by bellaire (Hermit) on Mar 12, 2009 at 14:06 UTC
    Are you sure the image contains IPTC data, and not EXIF data? AFAIK, they are two different standards. You might want to take a look at Image::EXIF.
      Thanks for the reply. I've asked my host to install this - hopefully it works :)

      Thanks again

      Andy
      Perfect, that works a charm

      Thanks for your help :)

      Andy
      MMm, tried all sorts, but just can't get it to extract the date :( (I need to extract the time the photo was taken)

      Any suggestions?

      TIA

      Andy