From: 12 34 Date: 2007-05-13T08:46:57+09:00 Subject: Re: EXIF Library Jeremy Hinegardner wrote: > On Sun, May 13, 2007 at 01:26:17AM +0900, 12 34 wrote: >> > require 'exifr' >> > puts "Standard items".center(72) >> > h.each_pair do |k,v| >> > puts "#{k.to_s.rjust(30)} : #{v}" >> > end >> > else >> > puts "No EXIF information in this image" >> > end >> > >> Jeremy >> I am enjoying. Learned several things with your help. "require" for >> example. > > require is how you pull in other ruby libraries into the current > file/program. Libraries must be 'required' before they can be utilized. > >> And some other nice details about outputting. I got it working >> by simplifying the beginning. I didn't understand two lines: >> cat exif-test.rb > > This is a copy and paste of the command line program 'cat' which dumped > the contents of hte file 'exif-test.rb' to the terminal/command window. > It is a unix command. The equivalent in Windows is 'type'. > > >> or >> image_file = ARGV.first >> lines. > > ARGV is a special global Array that holds the other parameters on the > command line after the ruby script. So in this case, at the command > line I had : > > ruby exif-test.rb image.jpg > ^ ^ ^ > | | +--- the image file being processed and first > | | element of the ARGV Array. It can be > | | accessed via ARGV[0] or ARGV.first > | | > | +---------------- The ruby program being invoked (accessed as > $0) > | > +--------------------- Invoking the ruby interpreter. > > >> As I changed the script it works for me. But in the interest of >> learning. I'm waiting for Black's book before going much further. > > You may also be interested in Programming Ruby > (http://pragmaticprogrammer.com/titles/ruby/index.html) > > enjoy, > > -jeremy Thanks Jeremy. I have the book and it's over my head. But Black's book arrived today. I ordered it because it is supposed to be a good intermediate book. I had looked up all the ARGV refs in Pickaxe and they didn't make much sense. I get "require," but still am learning what needs to be "required" and what's built in. I think I can see how ARGV will be useful, because eventually I'll be processing all the files in a folder. I'm running from TextMate in OS X, so wasn't thinking command line (which I use infrequently), so I'll pull in the file paths some other way. Much to learn and thanks again. Since exifr doesn't support Raw images (see separate posting), I also have to dig into the hooks to apps in the Mac OS to read the exif for Raw. But now that I've got Black I'll put some time in with that before working on my own project too much. Plus I have to take a vacation to Utah and Colorado in the next two weeks. Poor me. -- Posted via http://www.ruby-forum.com/.