Rmagick .tif image display

Hi. I'm trying to display a .tif image file on my web page.

The image is on another physical drive on the server and because .tif images don't display very well i decided to use Rmagick...

I would like to load the image from the server; convert it to a .png; display it on the web page.

If possible i don't want to create a physical .png file on the server.

The closest i've got is: read the file in, convert it to .png and write it to the server (which as i mentioned i dont want to do), and use <%= image_tag("file:///c:/temp/photo3.png") %> in the view.

It works, but just seems very clunky. Any ideas welcome...

Cheers.

Assuming that rmagick can give you the binary data for the png file, you should be able to just use send_data

Fred

Your clunky feeling is correct, your solution is a bit of fragile. At first, you should not convert image each time when somebody accessing it. In fact you _should_ write it down and then use saved copy in your views. RMagick consume memory, lots of it, if abused, so don't abuse it, please. Then, this <%= image_tag("file:///c:/temp/photo3.png") %> seems kind of wrong. Not sure if it ever worked, but, even if it was, I'm pretty sure there will be the point it will stop doing so. You have to use path, related to web root, not absolute path on your local drive. And last, but not least - do not use send_file. Use http://john.guen.in/rdoc/x_send_file/ instead.