Paperclip 2.7 Ruby 1.8.7企业版 Rails 3.1.0 Imagemagick 6.6
当我在我的应用程序上传图像时,它们由imagemagick正确处理,并且它们以正确的路径存储。但是,当我需要显示此文件时,找不到。
保存图片:
Started POST "/p" for 177.16.57.105 at Sun Sep 23 23:39:16 -0300 2012
Processing by ProductsController#create as HTML
Parameters: {"commit"=>"Salvar", "authenticity_token"=>"EgBUGfKIIduS2lkl0mh5p27pT0vF0/P8HXO852KHMM8=", "utf8"=>"â", "product"=>{"photo"=>#>, "price"=>"", "name"=>"Brigadeiro de pistache", "product_type"=>"1", "featured"=>"0", "description"=>"Brigadeiro de pistache"}}
[32mCommand[0m :: convert '/tmp/stream20120923-19588-vw8u1s-020120923-19588-3lym39-0[0]' -resize "120x80>" '/tmp/stream20120923-19588-vw8u1s-020120923-19588-3lym39-020120923-19588-16ky3i8-0'
[paperclip] Saving attachments.
[paperclip] saving /home/brigaderiagourmand/apps_rails/site/public/system/photos/24/short/brigadeirocolorido.png
Redirected to http://brigaderiagourmand.com.br/p/24
Completed 302 Found in 257ms
当我需要拿文件时......
Started GET "/photos/original/missing.png" for 177.16.57.105 at Sun Sep 23 23:39:17 -0300 2012
ActionController::RoutingError (No route matches [GET] "/photos/original/missing.png"):
我的模特
class Product < ActiveRecord::Base
attr_accessible :name, :description, :price, :photo, :product_type, :featured
attr_accessor :photo_file_name
has_attached_file :photo, :styles => { :thumb => "50x50>", :medium => "280x180>", :large => "585x400>", :short => "120x80>", :original => "200,200>" }
TYPES = ["Belga", "Normal"]
end
表单视图
= form_for @product, :html => {:multipart => true} do |f|
= f.file_field :photo
显示视图
= image_tag @product.photo.url(:original)
答案 0 :(得分:0)
处理图像的输出是否完整? 在您的输出回形针中,仅重新调整为短(120x80)
您的获取请求正在尝试加载missing.jpg,如果找不到请求,则这是图像的默认值。看一下/ home / brigaderiagourmand / apps_rails / site / public / system / photos / 24 /并查看是否有其他重新调整大小的照片。
Ryan Bates关于paperclip
的精彩截屏希望这有助于你