简体   繁体   English

回形针不显示图像

[英]Paperclip don't show the image

well i have this problem 好吧,我有这个问题

i have this in my model service 我的模特儿服务中有这个

class Service < ApplicationRecord
  belongs_to :user

    has_attached_file :images, :styles => {:md => "300x300>", :large => "500x500>" , :xl => "700x700#"}, :default_url => "/app/assets/images/thumb/missing.png"
    validates_attachment_content_type :images, :content_type => /\Aimage\/.*\Z/   

end

and this in my view Services#index 这在我看来Services#index

    <div>
      <%= image_tag service.images(:md)%>
    </div>

but there's a problem in my view the image set when i put :large or :xl but when i put :md the images don't shows. 但是在我看来,当我放:large或:xl时图像集存在问题,但是当我放:md时,图像不显示。 i don't know what's happening 我不知道发生了什么

If :large and :xl are working when you replace it with :md in your index view, then I would guess that there's simply no version for :md available to show. 如果在索引视图中用:md替换:large:xl可以正常工作,那么我想可能没有可供显示的:md版本。 Have you added :md to the model, after you actually already uploaded an image? 在您实际上已经上传图像之后,是否将:md添加到模型中? I would delete the image and try that again. 我将删除该图像,然后重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM