Questions tagged [carrierwave]

A modern ruby gem for file uploads in Rails and other frameworks, similar to paperclip and attachment_fu

This tag should be for questions that involve the carrierwave gem.

The github repository for carrierwave https://github.com/jnicklas/carrierwave has all of the important information about the gem.

An excellent Railscast on carrierwave: http://railscasts.com/episodes/253-carrierwave-file-uploads.

The ASCIICasts version is at http://asciicasts.com/episodes/253-carrierwave-file-uploads

A GoRails screencast is at https://gorails.com/episodes/file-uploading-with-carrierwave.

3028 questions
84
votes
6 answers

Rails 4 multiple image or file upload using carrierwave

How can I upload multiple images from a file selection window using Rails 4 and CarrierWave? I have a post_controller and post_attachments model. How can I do this? Can someone provide an example? Is there a simple approach to this?
SSR
  • 6,398
  • 4
  • 34
  • 50
59
votes
3 answers

Undefined method `image_will_change!' for CarrierWave on Heroku

I have a simple model that mounts a Carrierwave uploader. Everything works fine in development, but I get an undefined method "image_will_change!" error on heroku. class Receipt < ActiveRecord::Base mount_uploader :image, ImageUploader end class…
Sean Coleman
  • 1,287
  • 2
  • 10
  • 10
55
votes
3 answers

How to make carrierwave delete the file when destroying a record?

I'm using the carrierwave gem to upload files. I have built a system for users to flag images as inappropriate and for admins to remove the images. From what I can tell, calling destroy on the image will only remove the path name from the table. Is…
Oakland510
  • 1,073
  • 2
  • 12
  • 20
55
votes
10 answers

Displaying a Carrierwave filename in the view

I am trying to display the filename of a Carrierwave attachment in a Rails erb template. The following does not work: <%= @page.form.filename %> This seems in line with the documentation. Is some additional step needed? My page model looks like…
Chris Alley
  • 3,015
  • 2
  • 21
  • 31
52
votes
3 answers

Rails 3 paperclip vs carrierwave vs dragonfly vs attachment_fu

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…
40
votes
5 answers

Uploading a remote file url from Rails Console with Carrierwave

I just wanted to know how one would go about uploading a remote file url using Carrierwave in the Rails console. I tried the following without any luck. I presume it's not processing the Uploader? user = User.first user.remote_avatar_url =…
Wasabi Developer
  • 3,523
  • 6
  • 36
  • 60
36
votes
5 answers

carrierwave - rails 3.1- undefined method: image_will_change

I get an error that look like this: undefined method `post_image_will_change!' for # app/controllers/posts_controller.rb:43:in `new' app/controllers/posts_controller.rb:43:in `create' I've included this in my "post" model: …
buren
  • 742
  • 1
  • 8
  • 14
34
votes
7 answers

Carrierwave, MiniMagick - NoMethodError: undefined method `size' for nil:NilClass

On staging, I'm facing the following error on uploading and resizing an image through carrierwave and minimagick. On local everything works fine. carrierwave (0.9.0) mini_magick (3.7.0) irb(main):003:0> PicturePost.create(remote_content_url:…
rdsoze
  • 1,768
  • 1
  • 15
  • 25
31
votes
2 answers

Reprocessing images in Carrierwave

Let's say my model has an image with :thumb and the client wants :tiny and :nano thumbnails. How do I reprocess all the existing images using a rake task? I've found a rake task that I thought would do it https://gist.github.com/777788 but it's…
Joseph Le Brech
  • 6,541
  • 11
  • 49
  • 84
31
votes
6 answers

Renaming uploaded files with Carrierwave

I'm using Carrierwave to upload files, and I have it working. My issue is attempting to change the name of the uploaded file. In the generated uploader.rb there is a method I think I should be using def filename "something.jpg" if…
waving
  • 311
  • 1
  • 3
  • 4
31
votes
6 answers

Seeding file uploads with CarrierWave, Rails 3

I'm trying to seed a database in Rails 3 with images using CarrierWave, however nothing I try seems to work short of having to upload them all by hand. pi = ProductImage.new(:product => product) pi.image = File.open(File.join(Rails.root,…
Nathan Kleyn
  • 5,103
  • 3
  • 32
  • 49
31
votes
14 answers

Rails: NameError: uninitialized constant Article::ImageUploader when using Carrierwave on rails 4.1.5

I'm learning rails 4.1.5 I got this error: 2.1.1 :008 > Article NameError: uninitialized constant Article::ImageUploader from /Volumes/disk0s4/www/rails/blog/app/models/article.rb:4:in `' from…
Didin Ahmadi
  • 491
  • 1
  • 7
  • 14
31
votes
4 answers

exif image rotation issue using carrierwave and rmagick to upload to s3

I've got a photo upload feature in my rails app. The app uploads direct to s3 through carrierwave via rmagick and fog. The issue I am having is when a photo is uploaded via mobile through the "take a photo option" in portrait (note this is with…
lando2319
  • 1,509
  • 1
  • 19
  • 27
30
votes
4 answers

CarrierWave and resize to a specific width

Using CarrierWave in Rails 3.0 how would you go about making the code resize images that have a width larger than 500 pixels to be 500 pixels wide and adjust the height appropriately - keeping the same initial ratio of width to height.
BuddyJoe
  • 69,735
  • 114
  • 291
  • 466
30
votes
1 answer

Carrierwave; multiple uploaders or just one?

I have a post model and a podcast model. Both models have an attribute titled: image. I'm using one Carrierwave uploader (named ImageUploader) to handle both models. I have two questions before I go into production. Dumb question: Is it ok to use…
stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189
1
2 3
99 100