开发者

Question about Paperclip for Rails

开发者 https://www.devze.com 2022-12-25 15:37 出处:网络
I\'m using Papeclip(2.3.1.1) with Rails(2.3.5). In my view I write so: <%= link_to image_tag(p.attachment.url(:small)), p.attachment.url(:original) %>,

I'm using Papeclip(2.3.1.1) with Rails(2.3.5). In my view I write so:

<%= link_to image_tag(p.attachment.url(:small)), p.attachment.url(:original) %>,

and it becomes into

href="/system/attachments/1/original/1.JPG?1270134617 (for a tag)

src="/system/attachments/1/small/1.JPG?1270134617" (for img tag).

And when I click on the picture, my browser (Firefox) offers me to save or open picture and I want to just open picture in browser without any dialog开发者_JAVA技巧s. I think it's because link contains ?1270134617 after file's name. How can I fix it?


This could be related with the mime types.

Go to /config/initializers/mime_types.rb, and add (or uncomment, if it's there) this line:

Mime::Type.register "image/jpg", :jpg, ["image/jpeg", "image/pjpeg"]

Then restart your web server.

Hopefully this will make the picture "show on the browser" instead of "trying to download it".

0

精彩评论

暂无评论...
验证码 换一张
取 消