ruby on rails - paperclip doesn't create thumbnails on heroku -
i've been trying paperclip upload images amazon s3, original file being uploaded. no thumbnails generated. model has in it:
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"
the original file in fact uploaded, none of thumbnails appear. if copy src of thumb format image, instance,
<error> <code>nosuchkey</code> <message>the specified key not exist.</message> <key>screenshots/8/thumb.png</key> <requestid>b8a408560070e836</requestid> − <hostid> hahucunxgkvdvqe3gnhgt1rcbgfguxa35kqxmyre+ii60djs6r22chdr22coecea </hostid> </error>
this running on heroku, forces me use service amazon. not problem documentation can find makes straightforward. can't find dependencies (bundler happy), , i've been using aws 2 years now, without these problems, on site, different bucket on same account. problem of connecting bucket account? i'm using same credentials in other site. bucket changes.
a couple more things. directories being created in path of image being uploaded permissions 000 or whatever aws equivalent is. nobody permitted anything.
using rails 3.
i had same problem , answer lies in:
:path => ":attachment/:id/:style.:extension"
instead of storing images in same folder_id different names, use same name image , use style folders. above translate into:
:path => ":attachment/:id/:style/:filename"
so instead of trying generate like:
avatars/13/thumb.png avatars/13/medium.png avatars/13/large.png
you this:
avatars/13/thumb/my_pic.png avatars/13/medium/my_pic.png avatars/13/large/my_pic.png
Comments
Post a Comment