paperclip

Ruby: Paperclip, S3, and Deep-cloning

会有一股神秘感。 提交于 2020-01-02 05:38:22
问题 What I have is a Theme model, which contains many Assets. Assets are using Paperclip and storing their file content in my Amazon AWS-S3 system. I'm also using deep_clone because my customers have the ability to copy built in Themes and then modify them to their hearts content. All the deep_clone stuff is working great, but when I deep_clone the assets, the old file contents don't get added to my S3 buckets. The record gets saved to the database, but since the file-contents don't get saved

Multiple files uploading on Ruby on Rails 3 [closed]

断了今生、忘了曾经 提交于 2020-01-02 02:26:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I would like to upload multiple pictures to my Rails 3 application. I am currently using Paperclip to upload a picture, and I have some post processing operations assigned to the model Photo. I saw some samples on the net (integrating uploadify, swfupload or some other libraries), but none was very detailed, and

Paperclip - delete a file from Amazon S3?

最后都变了- 提交于 2020-01-01 10:58:12
问题 I need to be able to delete files from S3 that are stored by users, such as profile photos. Just calling @user.logo.destroy doesn't seem to do the trick - I get [paperclip] Saving attachments. in the logs and the file stays right there in the S3 bucket. How can the file itself be removed? 回答1: This are the methods from Paperclip that can be used to remove the attachments: # Clears out the attachment. Has the same effect as previously assigning # nil to the attachment. Does NOT save. If you

Can paperclip read photo geometry off an S3 bucket?

寵の児 提交于 2020-01-01 08:21:33
问题 I would like to read the geometry of a photo off of my S3 container. When it's on my local, this works : def photo_geometry(style = :original) @geometry ||= {} @geometry[style] ||= Paperclip::Geometry.from_file photo.path(style) end But it doesn't seem to work when I switch my model over to S3.. Any recommendations? The bigger story, is I'm trying to write some code that will allow me to retrieve photos from S3, allow users to crop them, and then reupload them back to S3 still assigned by

Rails missing image

ⅰ亾dé卋堺 提交于 2020-01-01 07:34:06
问题 I am currently using paperclip to upload images to my rails app. This is probably a very simple fix but how or where do I save the missing images to? This is the error that is produced from not having any missing images. How do I change this? ActionController::RoutingError (No route matches "/photos/normal/missing.png"): 回答1: If you don't need any control over the default image, which I don't think you need, you can place it in any folder under RAILS_ROOT/public/images/ Just make sure you

Paperclip and Amazon S3 Issue

二次信任 提交于 2020-01-01 05:50:51
问题 I have a rails app running on Heroku. I am using paperclip for some simple image uploads for user avatars and some other things, I have S3 set as my backend and everything seems to be working fine except when trying to push to S3 I get the following error: The AWS Access Key Id you provided does not exist in our records. Thinking I mis-pasted my access key and secret key, I tried again, still no luck. Thinking maybe it was just a buggy key I deactivated it and generated a new one. Still no

Securely Display an Image Uploaded with paperclip gem

北战南征 提交于 2020-01-01 05:37:07
问题 By Default: the paperclip gem stores all attachments within the public directory. I did not want to store the attachments within the public directory for security reasons, so I saved them within an uploads directory at the root of the app: class Post < ActiveRecord::Base belongs_to :user has_attached_file :some_image, path: ":rails_root/uploads/:attachment/:id/:style/:filename" do_not_validate_attachment_file_type :some_image end I did not specify the url option because I do not want a url

Rails - Paperclip validating attachment size when it shouldn't be?

寵の児 提交于 2019-12-31 21:42:12
问题 I've got a rails model using Paperclip that looks like this: has_attached_file :image, :styles => { :normal => ['857x392#', :png] }, :url => '/assets/pages/:id/:basename.:extension', :path => ':rails_root/public/assets/pages/:id/:basename.:extension' validates_attachment_size :image, :less_than => 2.megabytes When attempting to create a record of this model without an attachment to upload, the validation error is returned: There were problems with the following fields: * Image file size file

Ruby on Rails - Paperclip and dynamic parameters

五迷三道 提交于 2019-12-31 15:15:13
问题 I'm writing some image upload code for Ruby on Rails with Paperclip, and I've got a working solution but it's very hacky so I'd really appreciate advice on how to better implement it. I have an 'Asset' class containing information about the uploaded images including the Paperclip attachment, and a 'Generator' class that encapsulates sizing information. Each 'Project' has multiple assets and generators; all Assets should be resized according to the sizes specified by each generator; each

How exactly DO you integrate ckeditor with Paperclip so it can upload image files?

你离开我真会死。 提交于 2019-12-31 09:05:36
问题 How do you get http://github.com/galetahub/rails-ckeditor working so you can upload image files? I don't think I'll use the s3 storage... any help would be appreciated. 回答1: Yes you can. I assume that you have paperclip already set up for S3. So you have only edit the picture.rb and attachement_file.rb in you model directory (app/model/ckeditor/) and replace these lines has_attached_file :data, :url => "/ckeditor_assets/attachments/:id/:filename", :path => ":rails_root/public/ckeditor_assets