Image#write’s argument is in fact a String (f.path), not the Tempfile
object itself…
I see. I overlooked that earlier.
Normally Image#write either succeeds or raises an exception. I have
never seen it silently fail.
If you like, open a support request track on RubyForge with a simple
reproduction (just Ruby and RMagick, no Rails, etc.) and let me know
what O/S you’re on and what version of ImageMagick you have installed.
I’ll be glad to investigate.
and it works. Maybe RMagick just needs to check if there is an
extension ImageMagick can use.
Cheers,
Serabe
Duh. I had to figure this out just a few weeks ago. I should’ve
remembered. I must be getting old.
The Tempfile path ends in .0, which is not an extension ImageMagick can
use. As Serabe so intelligently points out, adding a valid extension
works. You can also add a prefix: “jpeg:” + f.path.
Thanks very much. Adding ‘jpeg:’ prefix solved the problem. This
solution is better because it keeps the temporary filename so the file
is still cleaned up.
Solution:
tmp_path = Tempfile.new('tmp_img').path
@img.write('jpeg:' + tmp_path) # writes to tmp_path
Thanks !
Gaspard
Le 26 août 08 à 00:47, Tim H. a écrit :
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.