paperclip-dropbox 问题,不在记录中显示图像

Issue with paperclip-dropbox, not show images in records

我有 rails 网络应用程序,我将其与回形针投递箱连接。上传效果很好,但我无法在我的应用程序上打开图片。当我尝试打开图像时,我得到网址:https://dl.dropboxusercontent.com/u/393213417/Koala_medium.jpg 并发出:"It seems you don't belong here! You should probably sign in. Check out our Help Center and forums for help, or head back to home. "

型号:

class Message < ActiveRecord::Base

  has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "150x150>" },
  :storage => :dropbox,
      :dropbox_credentials => Rails.root.join("config/dropbox.yml"),
      :dropbox_visibility => 'public'

  validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/


  validates_presence_of :topic, content:   "- Dopisz"

end

似乎 paperclip-dropbox is producing old-style Dropbox "Public" links,并非每个帐户都启用。您可以在此处找到有关 Dropbox Public link 的信息:

https://www.dropbox.com/help/16

如果您的帐户未启用它,您的结果 link 将像那样失败,并出现 403 错误。

相反,Dropbox API 提供了一个实际的 API 端点,用于获取 link 文件:

https://www.dropbox.com/developers/core/docs#shares

可以根据需要针对不同的行为修改这些 link,如下所示:

https://www.dropbox.com/help/201