From: David Alan Black Date: 2001-12-27T20:47:38+09:00 Subject: [ruby-talk:29471] Re: imageMagick Hello -- On Thu, 27 Dec 2001, Bashar A. Asad wrote: > hi, > thanks for the reply I tried it without #{} thingy and this is what came up > with > dir = "." > > def no_ext(n) > n.sub(/\.gif/,'') > end > > > def createThumbFile(f) > img = Magick::Image.new(f) > img.scale('60%') > n = no_ext(f) > img.write("filename"=>f+"thumb.gif") Do you mean n here, rather than f? > end > > Dir.foreach(dir){|file| > createThumbFile(file) > } > and didn't work, the error message below > /usr/lib/ruby/1.6/magick.rb:63: warning: Unable to open file: . (330) It's trying to process the first file it sees, which is "." (the current working directory). What you really want to do, I think, is process GIF files. So how about.... files = Dir["*.gif"] then later: files.each {|file| create_thumb_file(file)} (sorry, I just can't bring myself to type camelcase method names :-) Or just do the whole thing as: Dir["*.gif"].each do |file| # code to create thumb file end David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav