Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

freakingwildchild's scratchpad

by freakingwildchild (Scribe)
on Jul 14, 2006 at 08:53 UTC ( [id://561181]=scratchpad: print w/replies, xml ) Need Help??

sub get_metadata { my $self = shift; my $file = $_[0] || return 0; use Image::ExifTool qw(:Public); my $exifTool = new Image::ExifTool; my $meta; $meta->{info} = $exifTool->ExtractInfo($file); my @extracttags = qw(Author Copyright MIMEType ImageWidth ImageHeigh +t XResolution ISO Make ImageSize CreateDate FileType Comment CompressionType AudioLayer AudioBitrate SampleRate C +opyrightFlag AspectRatio VideoBitrate CodecList ContentEncryption Compression FrameRate FrameCount Duration + copyright description title Artist Album Year PlayCounter PublisherURL UserDefinedURL CommercialURL Model Foca +lLength Lens Subject Producer ModifyDate PageCount BackgroundColor URL Version -ID3v1:Author -ID3v1:Comment - +ID3v1:Title -ID3v2_3:Album -ID3v2_3:Artist -ID3v2_3:Year); $exifTool->Options(Duplicates => 0); $meta->{info} = ImageInfo($file, \@extracttags); sub clear_dupekeys { # clear out nasty keys on a nasty way so they a +re xml compliant and not duplicate my $self = shift; my $tag = shift; $tag =~ s/ \(1\)$//i; my $dupetag = $tag; $dupetag .= " (1)" if not substr($dupetag,length($dupetag)-4,4) eq + " (1)"; if ($meta->{info}->{$dupetag}) { $meta->{info}->{$tag} = $meta->{info}->{$dupetag}; delete $meta->{info}->{$dupetag}; } } my $temphash = $meta->{info}; for my $keyref ( keys %$temphash ) { $self->clear_dupekeys($keyref); } $meta->{type} = Image::ExifTool::GetFileType($file, 1); no Image::ExifTool; return $meta; }
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-24 05:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found