paperclip

Problems installing RMagick with Paperclip in Rails 3

不羁的心 提交于 2019-12-07 15:13:18
问题 I'm trying to use paperclip in rails and when I'm doing the "bundle install" I'm getting the following error: Can't install RMagick 2.13.1. Can't find Magick-config in /usr/local/mysql/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/Users/seanhinton/.rvm/bin What I'm wondering is how do I install RMagick (is that what I need?) on my machine (it's OSX 10.6)? Cheers! 回答1: RMagick is a ruby adapter for ImageMagick. Getting

fields for images don't displays in active admin form

强颜欢笑 提交于 2019-12-07 14:41:12
问题 gem "formtastic", "~> 2.1.1" gem "activeadmin", "~> 0.4.2" gem "paperclip" fields for photos don't displays in active admin form app/views/admin/products/_form.html.erb ,but the same form in app/views/products/_form.html.erb works correctly in product's views > app/admin/products.erb ActiveAdmin.register Product do form :partial => "form" end app/views/admin/products/_form.html.erb <%= semantic_form_for [:admin , @product ], :html => { :multipart => true } do |f| %> <%= f.semantic_errors

Paperclip - undefined method `match' for nil:NilClass

天大地大妈咪最大 提交于 2019-12-07 11:35:54
问题 I'm new to rails, and ruby. I'm creating a simple application where I can upload a photo. I have the paperclip gem installed and I'm trying to configure it within my model to specify a thumbnail size like so: has_attached_file :photo, :styles => {:thumb => '120x120>', :large => '640x480>' }, :default_style => :thumb, :url => "/system/photos/:basename.:extension", :path => ":rails_root/public/system/photos/:basename.:extension" However, I keep receiving the error: undefined method `match' for

Can't Save Image Attributes with Paperclip in Rails 4

社会主义新天地 提交于 2019-12-07 08:27:08
问题 I have two associated models in my Rails 4 app: product.rb and image.rb . The Image model allows attached files using the Paperclip gem. Images belong_to a Product, and a product has_many Images. I would like to use the Product's new view to create and attach an image when I create a product. Each time I try, the parameters associated with the Paperclip image do not get saved, and end up nil . Here are the models: Product.rb class Product < ActiveRecord::Base validates :name, :part_number,

paperclip inputs and previews for uploaded images in edit action

牧云@^-^@ 提交于 2019-12-07 08:00:32
问题 I am using paperclip and rails 4 and multiple image uploading works correctly. However I would like to configure it to allow uploading of a maximum of 3 images and only show inputs and previews for uploaded images. If I upload an image out of the 3 possible images.. and then go to the edit action.. it still shows 3 upload input elements instead of 2. And all of them say "no file chosen" which is not good for the user. The user might replace the image while thinking they are adding a new one.

How do I get a temporary File object (of correct content-type, without writing to disk) directly from a ZipEntry (RubyZip, Paperclip, Rails 3)?

断了今生、忘了曾经 提交于 2019-12-07 06:54:10
问题 I'm currently trying to attach image files to a model directly from a zip file (i.e. without first saving them on a disk). It seems like there should be a clearer way of converting a ZipEntry to a Tempfile or File that can be stored in memory to be passed to another method or object that knows what to do with it. Here's my code: def extract (file = nil) Zip::ZipFile.open(file) { |zip_file| zip_file.each { |image| photo = self.photos.build # photo.image = image # this doesn't work # photo

Uploading & Unzipping files to S3 through Rails hosted on Heroku?

谁说我不能喝 提交于 2019-12-07 05:23:56
问题 I'd like to be able to upload a zip file to my Rails application that contains a number of images. Then I'd like Rails to unzip that file and attach the images inside to my Photo's model via Paperclip, so that they are ultimately stored on my Amazon S3 account (configured through Paperclip). I'd like do do this all on my Rails site hosted on Heroku, which unfortunately doesn't allow local storage of any kind (so far as I'm aware) to temporarily do the unzipping before the Paperclip parsing.

How do I pass a variable watermark path to a paperclip watermark processor?

牧云@^-^@ 提交于 2019-12-07 05:23:16
问题 I have watermarks, galleries, and photos models. Gallery belongs_to Watermark Photo belongs_to Gallery class Photo < ActiveRecord::Base before_save :save_dimensions, :set_orientation belongs_to :gallery has_attached_file :image, :processors => [:watermark], :styles => { :thumbnail => ["80x80>"], :small => { :geometry => "200x200>", :watermark_path => "#{gallery.watermark.image.path(:small)}", :position => "Center" }, :medium => { :geometry => "400x400>", :watermark_path => "#{gallery

Where does heroku store uploaded files when using paperclip

安稳与你 提交于 2019-12-07 05:19:21
问题 I have created a simple ROR application and installed paperclip with this configuration has_attached_file :attachment, :path => ":rails_root/public/system/:attachment/:id/:filename", :url => "/system/:attachment/:id/:filename then i created a simple form that takes the file as input from the user web browser, after that the file url is being displayed model.attachment.url and the user can download the file again. I tried to run some linux commands to know where are downloaded files are stored

Rails - building an absolute url in a model's virtual attribute without url helper

我们两清 提交于 2019-12-07 04:05:21
问题 I have a model that has paperclip attachments. The model might be used in multiple rails apps I need to return a full (non-relative) url to the attachment as part of a JSON API being consumed elsewhere. I'd like to abstract the paperclip aspect and have a simple virtual attribute like this: def thumbnail_url self.photo.url(:thumb) end This however only gives me the relative path. Since it's in the model I can't use the URL helper methods, right? What would be a good approach to prepending the