微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Rails - Papercrop - 能够裁剪图像,但样式格式的图像被保存为黑块图像

如何解决Rails - Papercrop - 能够裁剪图像,但样式格式的图像被保存为黑块图像

我遵循了所需的所有步骤,但有时当我调整裁剪器的大小并保存图像时,它会正确裁剪图像并保存正确的“原始”图像,但小、缩略图、大这些相同图像的变体被保存为黑色块。 图片样式类型:小、中、大、缩略图

    as_attached_file :header_image,styles: { small: "720x300#",medium: "1440x600#",large: "2880x1200#",thumbnail: "360x360#",original: {convert_options: '-strip'} },default_url: "/assets/missing1.png",hash_data: ":class/:attachment/:id/:style",path: '/:class/:attachment/:id_partition/:style/:hash',hash_secret: PAPERCLIP_HASH_SECRET
  crop_attached_file :header_image,:aspect => "12:5"
  validates_attachment_content_type :header_image,:content_type => ["image/jpg","image/jpeg","image/png","image/gif"]

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。