technoweenie / attachment_fu

Treat an ActiveRecord model as a file attachment, storing its patch, size, content type, etc.
http://weblog.techno-weenie.net
MIT License
1.02k stars 337 forks source link

displaying pdf attachment inline, in the view (problem with browsers on Windows) #18

Open arta opened 14 years ago

arta commented 14 years ago

This is not an attachment_fu issue, I think, but somebody here may know what the problem is.

I have my attachments in the cloud. When I want to display an attached file in my rails app's view, I write (in the view, haml):

= image_tag @model.attachment.public_filename

and the attachment (image or pdf) is neatly displayed inline in the view.

But this only works on a Mac. The same page accessed from a browser running on Windows displays broken image holder for pdf attachments (no problem with images).

Why is that? How to fix that? How do I display a pdf attachment inline in a browser on Windows? I've searched around and found nothing. So, I post the question here.

Suggestion and help appreciated, Thanks, martin

parndt commented 14 years ago

You're right not an attachment_fu issue. Last I checked you can't display it inline without using some sort of plugin as the browser does what the user wants. Also a PDF doesn't belong in an tag so no wonder you're getting a broken image icon :-)

arta commented 14 years ago

Thanks, would you know the plugin? The broken image icon appears on Windows only. Browsers running on MacOS display the pdfs as if they were images (which in a sense they are, those are scanned documents, pdf takes up less memory then jpg). If this is not a bug, then what image tag handles is a matter of opinion/interpretation. After all, it's not like there are natural laws governing the contents of HTML tags. Or maybe there is a need for a doc tag?