paperclip

Rails - paperclip - Multiple photo upload not saving

二次信任 提交于 2019-12-07 03:07:48
问题 I'm trying to make a create product page in rails. This includes adding multiple images and text fields. I have one model for products and one for photos. I'm using the paperclip gem for photo upload. But I get no picture when I view product page. Photos are not being saved to database. P.S. I use HAML. app/views/products/show.html.haml %b Name = @product.name %br %b Description = @product.description %br - @product.photos.each do |photo| = image_tag photo.image.url app/controllers/products

Rails Paperclip conflict between aws-s3 gem and right_aws gem. How to solve?

浪尽此生 提交于 2019-12-07 01:56:56
问题 for a new App I want to use paperclip to store Files to S3. I already have installed the aws-s3 gem for another app. That seems to cause some problems, because Paperclip should use right_aws but is trying to use the aws-s3 gem. But I don't want to remove the aws-s3 gem from my system. Is there a way to solve this conflict? Maybe by forcing paperclip to use right_aws? Or by changing the configuration? My setup # enviroment.rb config.gem 'right_aws' # my model with the attachment has_attached

Change error validation message in Paperclip

£可爱£侵袭症+ 提交于 2019-12-07 01:43:49
问题 When you set a validation message in paperclip, such as validates_attachment_presence, :image, :message => 'xxxx' The custom message comes automatically prefixed with the name of the field, even though it has been overwritten with the :message . How do you totally override the message and make it totally custom? Edit: typo 回答1: Not a real solution but a Easy one is to skip paperclip validation and write custom one. validate :check_content_type def check_content_type if !['image/jpeg', 'image

Paperclip - Running a method after the file is saved?

雨燕双飞 提交于 2019-12-06 21:38:28
问题 I'm working on a project that needs to accept file uploads. After the file is uploaded, I'm doing some processing - extracting information from the file. I eventually plan to run this in a background worker, but it's currently running inline. I've tried making use of both after_create and after_save to process the file, but it seems my method is ran before the save method from Paperclip - so my tests fail with "No such file or directory". Is there any way to trigger the save method early, or

Multi file upload with rails_admin (Carrierwave, Paperclip, Dragonfly)

北城以北 提交于 2019-12-06 20:40:29
I'm looking for a quick solution for multi file upload with rails_admin. Any ideas or solutions out there? The approach I'd take here is to develop a custom action which would include it's own view and controller processing. You can generate a rails_admin plugin with the directions at the top of the page here . And here are some examples of custom actions I've built out: Import Print to PDF The import plugin has a supporting blog article here . This is the file you want to look at where you add your upload behavior inside the :controller instance option. 来源: https://stackoverflow.com/questions

Resize original image in Paperclip

独自空忆成欢 提交于 2019-12-06 17:14:25
问题 Paperclip stores original images in "original" folder. Is there a way to resize the original images? I want to make the originals smaller in order to save the disc space. So, for example, if visitor uploads a photo with 2592x1936 I want to store it as 1024x1024, the same way we set the dimensions for :thumb images in :styles Update (solved) I found out how to resize original images automatically on upload. One just needs to add :original to styles: class MyModel < ActiveRecord::Base has

How do I save images via options_for_select with Paperclip and Image Picker on Rails 4?

偶尔善良 提交于 2019-12-06 15:25:36
I'm trying to save images via a form that populates a "Select" field with a number of options. The select form uses Image Picker to change the options when an user clicks on a selected image. When the form is submitted, the selected image should be saved with the Paperclip gem. I think I just need to point the image url from the selected option to a method that will open it in Paperclip, but I'm not quite sure how to do that. I'm new to Rails, and humbly appreciate anything that will point me in the right direction! Here's what I have: _form.html.erb <%= f.select( :medium_id, options_for

Rails convert Paperclip directory structure to Carrierwave

限于喜欢 提交于 2019-12-06 15:12:28
I was using the Paperclip gem: https://github.com/thoughtbot/paperclip I'm now using Carrierwave: https://github.com/carrierwaveuploader/carrierwave My production website is currently using Paperclip. I'm going to be updating the production website to use Carrierwave. The folder structure for uploads in Paperclip differs from Carrierwave. I'm also using Amazon S3 to store uploads. I'm wondering if there's a way to convert my production files uploaded with Paperclip to Carrierwave. For example, with Paperclip in production I currently have something like the following for resumes: bucket_name

Rails3, S3, Paperclip Attachment as it's own model?

左心房为你撑大大i 提交于 2019-12-06 14:44:58
So, I'm working on an app where users can upload and manage photos with a bunch of industry specific metadata attached to them. The Photo model has all this metadata in it, and I'm using Paperclip to attach the actual image file to the model and store the images on Amazon S3. The user interaction currently works like this: A user clicks "Add Photo" and is taken to the "New Photo" page where he is presented a form. The first thing on the form is a file chooser. The user selects a file. Beneath this are several different fields of metadata for the user to fill out, so the user fills these out.

Resize Error - Paperclip::Errors::NotIdentifiedByImageMagickError

本小妞迷上赌 提交于 2019-12-06 14:19:37
问题 I just installed paperclip into my app to upload images, and everything was working well until I tried to add the styles to make the image resize. (I can upload images fine before I add this code) on pins.rb: has_attached_file :image, styles: { medium: "300x300>" } I then added the class to on _pin.html.rb: <td><%= image_tag pin.image(:medium) %></td> But now, when I try and upload an image, I get the error: Paperclip::Errors::NotIdentifiedByImageMagickError When I remove the styles, it works