From: Gaspard Bucher Date: 2008-08-26T05:02:21+09:00 Subject: Re: RMagick write fails / to_blob works Image#write's argument is in fact a String (f.path), not the Tempfile object itself... > Gaspard Bucher wrote: >> I am trying to use @img.write(path) but it's not working (zero bytes >> written). Using "to_blob" works. >> >> >> f = Tempfile.new('tmp_img') >> FAILING CODE: >> @img.write(f.path) >> >> WORKING CODE: >> File.open(f.path, 'wb') do |f| >> f.syswrite(@img.to_blob) >> end > > Image#write doesn't know what to do with a Tempfile object. It can > only > accept a string or a File object that's been opened for output. > > Image#write calls directly into ImageMagick, and ImageMagick doesn't > know anything about Ruby objects like Tempfiles. > -- > Posted via http://www.ruby-forum.com/. >