paperclip

Rails Paperclip how to delete attachment?

允我心安 提交于 2019-11-26 11:49:26
问题 I am using Paperclip (w/ Amazon s3) on Rails 3. I want to delete an existing attachment without replacing it using an update action. I\'ve only found one example of this here and could not get that to work, it just wouldn\'t delete and there was nothing in the logs to say why. I wanted to do something like this on the form: <%- unless @page.new_record? || !@page.image? -%> <%= f.check_box :image_delete, :label => \'Delete Image\' %> <%- end -%> (page is the name of the model, image is the

Uploading multiple files with paperclip

本秂侑毒 提交于 2019-11-26 11:14:52
问题 I am having problems uploading multiple files using paper clip, my models are as such slider has_many imgarrays imgarrays has_many imageobjects imageobjects have_attachment(as for paperclip) I have no problems receiving a single image and saving it using paperclip on my other models, but i am not sure of how to handle the array returned by imgarrays param during a multiple file upload. Here is my rails server logs: Started POST \"/slider\" for 127.0.0.1 at 2012-07-23 10:14:17 +0800 Processing

Rails 3 paperclip vs carrierwave vs dragonfly vs attachment_fu [closed]

泄露秘密 提交于 2019-11-26 10:21:10
问题 I\'m working on upgrading a Rails 2.3.11, Ruby 1.9.2 app to Rails 3.0.10, and attachment_fu no longer works. I\'m looking at changing to paperclip, carrierwave, or dragonfly for file uploads, or maybe a Rails 3 compatible, maintained version of attachment_fu. Which of these options would be the best to use in terms of performance, how well maintained it is, how easy it is to upgrade from attachment_fu, and maybe is it going to be Rails 3.1 compatible? What are the major strengths and

rails paperclip and passenger `is not recognized by the &#39;identify&#39; command`

杀马特。学长 韩版系。学妹 提交于 2019-11-26 08:08:52
问题 When I upload a photo, my model fails validation, err well even without any validations I\'m returned this error: /tmp/stream20100103-13830-ywmerx-0 is not recognized by the \'identify\' command. and /tmp/stream20100103-13830-ywmerx-0 is not recognized by the \'identify\' command. I\'m confident this is not related to ImageMagick because I\'ve removed any image processing from the uploading, also I\'ve tried uploading different mime types, like .txt files and the such. Additionally, I found

Paperclip exception : Paperclip::AdapterRegistry::NoHandlerError

爷,独闯天下 提交于 2019-11-26 04:26:27
问题 Using Paperclip 3.0.1 in rails 3.2.2 I got this error: **Paperclip::AdapterRegistry::NoHandlerError** (No handler found for \"2009-11-29-133527.jpg\"): In my model I have: class Product < ActiveRecord::Base ... has_many :assets accepts_nested_attributes_for :assets end class Asset < ActiveRecord::Base belongs_to :product has_attached_file :image, :path => \":rails_root/public/system/:attachment/:id/:style/:filename\", :url => \"/system/:attachment/:id/:style/:filename\", :styles => { :medium

Save image from URL by paperclip

柔情痞子 提交于 2019-11-26 04:05:00
问题 Please suggest me a way to save an image from an URL by Paperclip. 回答1: Here is a simple way: require "open-uri" class User < ActiveRecord::Base has_attached_file :picture def picture_from_url(url) self.picture = open(url) end end Then simply : user.picture_from_url "http://www.google.com/images/logos/ps_logo2.png" 回答2: In Paperclip 3.1.4 it's become even simpler. def picture_from_url(url) self.picture = URI.parse(url) end This is slightly better than open(url). Because with open(url) you're