From: ara.t.howard@... Date: 2006-11-17T08:44:08+09:00 Subject: Re: Another IO.popen question ... On Fri, 17 Nov 2006, Joel VanderWerf wrote: > Adam Groves wrote: >> Hi Joel, >> >> thanks for the speedy reply! The problem is, I need to pass on a file >> object (which has been uploaded from a web page form) to 'convert' and not >> just a path. I should have made this clearer in my original post. >> >> Any ideas? >> > > Untested, but maybe something like this? > > file = File.open("mypdf.pdf") > IO.popen("convert -resize 700x700 pdf:-[0] png:-") do |f| > while (data=file.read(N)) > f.write data > end > end careful, if you don't read the child will block when the pipe becomes full i think. you might need to add file = File.open("mypdf.pdf") png = IO.popen("convert -resize 700x700 pdf:-[0] png:-") do |f| while (data=file.read(N)) f.write data end f.close_write f.read end not sure if that was obvious or not... sorry if it was. -a -- my religion is very simple. my religion is kindness. -- the dalai lama