carrierwave

Carrierwave s3 403 (Forbidden) error

萝らか妹 提交于 2019-12-24 03:39:53
问题 I'm trying to get carrierwave to work with Amazon S3 (in my Rails 4 app), I use fog gem to upload the images to s3 . I'm currently successfully able to upload the files to my bucket. But I cannot get the images back. server is giving 403 (Forbidden) error However if I check the image, it's there uploaded in S3. My image path would be something like https://<bucket name>.s3.amazonaws.com/uploads/image/picture/8/card_34676_l.jpg&Signature=<signature>&Expires=<expires> Following is my

“stack level too deep” When Processing Carrierwave Image Versions in Nested Form

别说谁变了你拦得住时间么 提交于 2019-12-24 03:23:20
问题 This is a strange problem and, unfortunately, it has many potential sources. I am using carrierwave and cocoon gems to help with nested file uploads. Any type of version processing I do in my uploader causes a stack level too deep error. If I remove the processing, it saves the nested images normally. I have tried to do a lot of troubleshooting and have narrowed it down to that; for example, if I remove just the version processing, then it works normally. If I remove everything except the

Passing a parameter to the uploader / accessing a model's attribute from within the uploader / letting the user pick the thumbnail size

天涯浪子 提交于 2019-12-24 03:22:17
问题 I would like to crop an image to the size the user has selected from a list (e.g. 100x100px, 200x200px,...) How would I pass that attribute to the uploader or get the model's attribute from within the uploader? Accessing the model's attribute from within the uploader as following does not work: version :thumb do thumbnail_size = model.thumbnail_size ... ... end I get following error: undefined local variable or method `model' for # Thank you! Florian 回答1: In order to be able to access the

Rails 4, Carrierwave-aws, images uploaded to Amazon s3 locally, but not in production (Openshift)

◇◆丶佛笑我妖孽 提交于 2019-12-24 02:52:54
问题 I have a Rails 4 application hosted on openshift. I am using carrierwave and the carrierwave-aws gem to handle image upload. When I test it locally, the images are uploaded and displayed as expected to Amazon S3. However, on production server, which is hosted on Openshift, the images are uploaded to '/uploads/images' instead of Amazon. Here are my configurations and Gemfile: gem 'carrierwave' gem 'carrierwave-aws' In initializers/carrierwave.rb #config/initializers/carrierwave.rb CarrierWave

Rails4: To check for no image uploaded with carrierwave is not working when delete the image

人盡茶涼 提交于 2019-12-24 02:25:27
问题 What I want to do is for users to select at least one image (up to 3 images) and to enter f.text_area :content in \views\shared\ _article_form.html.erb. I added a custom validation check_for_at_least_image in \models\article.rb. It works (error message is displayed) only in create action, but it doesn't work in update action. How can I check no image and display error message in update action. article has many photo . The logs are as followings. \log/development.log no image when new create

Rails 4 carrierwave gem TypeError on assign to uploader

孤街醉人 提交于 2019-12-24 02:22:10
问题 I'm using the carrierwave gem to set up image upload on a nested form. The uploader looks like: class CarImageUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick if Rails.env.production? storage :fog else storage :file end def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end def default_url 'default-no-car-pic.png' end version :thumb do process :resize_to_fit => [50, 50] end def extension_white_list %w(jpg jpeg gif png) end end The model

Can't save Image to database using CarrierWave Direct

杀马特。学长 韩版系。学妹 提交于 2019-12-24 01:44:49
问题 I am using CarrierWave Direct with Sidekiq to upload images to Amazon S3 in the background. The images are being uploaded as expected, but I can't seem to add the image record to the database. When I raise errors, I get that filename can't be blank . Here is the relevant code: app/uploaders/image_uploader.rb class ImageUploader < CarrierWave::Uploader::Base include CarrierWaveDirect::Uploader include CarrierWave::MimeTypes process :set_content_type end app/controllers/admin/images_controller

Carrierwave + fog + aws s3 and rails in production

↘锁芯ラ 提交于 2019-12-23 23:52:03
问题 I have just migrated from paperclip to carrierwave and managed to successfully get uploading to S3 to work locally on my machine, but after deploying the Rails application to my server (which uses Ubuntu, Passenger with nginx, was a mission getting it to work), and when i try to upload an image, it tries to save it to public/uploads/... which comes up with a permission denied error, I have looked and searched everywhere to find out why its not working, and have found nothing. My Uploader file

CarrierWave: Single uploader for multiple models?

烈酒焚心 提交于 2019-12-23 23:25:11
问题 How do I make the single image uploader do different actions depending on the model it is creating the image for? I have one image uploader, and I want to upload images for Users and for Posts. For the user, I want the original image & thumbnail (70x70). For the Posts, I want the original image and featured thumbnail (260x180). I could just make 3 versions for every image and just call the desired one, but that's probably really bad since it would clog my storage database. I looked at:

No route matches error while uploading a file with Carrierwave

橙三吉。 提交于 2019-12-23 21:11:38
问题 I have a simple file upload form where a user should be able to select a csv file from their machine and then save it to a file folder. I am trying to user Carrierwave and my app is built in Ruby on Rails. When I try to save the file, I get the error "No route matches [POST] "/customers/new". Here are the various components. /new.html.erb <%= form_for :dataload, :html => {:multipart => true} do |f| %> <p> <%= f.file_field :file %> </p> <p><%= f.submit %></p> <% end %> /models/dataload.rb