From: David Alan Black Date: 2001-12-27T12:24:42+09:00 Subject: [ruby-talk:29455] Re: imageMagick Hello -- On Thu, 27 Dec 2001, Bashar A. Asad wrote: > hello again, > I tried to write the script that will read img file and create thumbs from > the dir, and this is what I came up with but its not working, it spells out a > parse error on n = no_ext(#{f}), what am I doing wrong? Well, you've started a comment at a very strange place :-) I think you mean: no_ext(f) don't you? Also: > require "magick" > > dir = "." > > def no_ext(n) > r="#{n}" Why not just: r = n > r.sub(/\.gif/,'') If that's all that r exists for, then you could do just: def no_ext(n) n.sub(/\.gif$/, '') end which won't do any damage to n. > end > > > def createThumbFile(f) > img = Magick::Image.new(#{f}) Here, again, #{f} isn't what you mean: img = Magick::Image.new(f) > img.scale('60%') > n = no_ext(#{f}) > img.write("filename"=>"#{n}_thumb.gif") > end > > Dir.foreach(dir){|file| > createThumbFile("file") > } "file" (in quotation marks) isn't going to give you the name of the file -- it's going to give you the word "file" every time. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav