开发者

Question about Paperclip for Rails

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜