Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 回形针不';不要在heroku上创建缩略图_Ruby On Rails_Heroku_Paperclip - Fatal编程技术网

Ruby on rails 回形针不';不要在heroku上创建缩略图

Ruby on rails 回形针不';不要在heroku上创建缩略图,ruby-on-rails,heroku,paperclip,Ruby On Rails,Heroku,Paperclip,我一直试图让回形针上传图像到亚马逊s3,但我得到的只是上传的原始文件。没有生成缩略图。我的模型中包含以下内容: has_attached_file :screenshot, :styles => { :thumb => "100x80>", :medium => "195x150>", :large => "390x300>" }, :storage => :s3, :s3_credentials =>

我一直试图让回形针上传图像到亚马逊s3,但我得到的只是上传的原始文件。没有生成缩略图。我的模型中包含以下内容:

  has_attached_file :screenshot, :styles => {
    :thumb => "100x80>",
    :medium => "195x150>",
    :large => "390x300>"
  },
  :storage => :s3,
  :s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
  :path => ":attachment/:id/:style.:extension"
事实上,原始文件已上载,但未显示任何缩略图。例如,如果我复制thumb格式图像的src,我得到

<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>screenshots/8/thumb.png</Key>
<RequestId>B8A408560070E836</RequestId>
−
<HostId>
HAHUCuNxGKVDvqE3GnhGT1RcBgFGUxa35kqXmyRE+ii60DJS6r22ChDr22cOeCea
</HostId>
</Error>
这是在heroku上运行的,这迫使我使用类似amazon的服务。这不是一个问题,但我能找到的所有文档都让这看起来很简单。我找不到任何依赖项(bundler很高兴),我已经在另一个站点上使用AWS两年了,没有这些问题,在同一个帐户上使用不同的bucket。是否存在将存储桶连接到帐户的问题?我使用的凭据与其他站点中的凭据相同。只有桶变了

还有几件事。正在上载的映像路径中创建的目录是permissions 000或aws等效目录。任何人都不允许做任何事


使用Rails 3.

我安装了曲别针作为插件,一切正常


别忘了从gem文件中删除gem。

我也有同样的问题,答案在于:

:path=>“:attachment/:id/:style.:extension”

不要使用不同的名称将图像存储在同一个文件夹中,而是对图像使用相同的名称,并对文件夹使用样式。上述内容将转化为:

:path=>“:attachment/:id/:style/:filename”

因此,与其尝试生成以下内容:

avatars/13/thumb.png
avatars/13/medium.png
avatars/13/large.png
你得到这个:

avatars/13/thumb/my_pic.png
avatars/13/medium/my_pic.png
avatars/13/large/my_pic.png

这方面有什么更新吗?以下任何一个答案正确吗?