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
30
votes
7 answers

Carrierwave, creating a duplicate attachment when duplicating its containing model

I would like to duplicate a model. The original model contains an attachment through Carrierwave. Ideally, a new attachment would be created, that is a copy of the original image, for the new model object. I have looked through the Carrierwave…
eraticus
  • 407
  • 1
  • 4
  • 6
28
votes
3 answers

Carrierwave - Resizing images to fixed width

I'm using RMagick and want my images to be resized to a fixed width of 100px, and scale the height proportionally. For example, if a user were to upload a 300x900px, I would like it to be scaled to 100x300px.
David
  • 607
  • 1
  • 8
  • 12
28
votes
1 answer

Rails Error: ImageMagick/GraphicsMagick is not installed

I get this error when i ran my rails app on my OSX and i tried to upload an image. I have a "product" model and i am using Mini_Magick with CarrierWave for uploading the product's image. When i create a product on my ubuntu's laptop, it works fine,…
ascherman
  • 1,762
  • 2
  • 20
  • 41
25
votes
5 answers

Carrierwave files with Capistrano

I'm using rails 3.2 with asset and carrierwave for upload some images, they store in /public/uploads/photo/..... but when I do a cap:deploy (with capistrano) my current directory application doesn't contain the files I uploaded, because capistrano…
eveevans
  • 4,392
  • 2
  • 31
  • 38
25
votes
4 answers

How to assign a remote file to Carrierwave?

I have video model with the following definition: class Video require 'carrierwave/orm/activerecord' mount_uploader :attachment, VideoUploader mount_uploader :attachment_thumbnail, VideoThumbnailUploader ... end When I upload a video file.…
Christian Fazzini
  • 19,613
  • 21
  • 110
  • 215
23
votes
5 answers

Use CDN with carrierwave + fog in s3 + cloudfront with rails 3.1

I'm using fog with carrierwave in my website. But the images load very very slowly. Then I want to speed up loading of images with a CDN. I have followed this tutorial for create the CDN for…
hyperrjas
  • 10,666
  • 25
  • 99
  • 198
23
votes
3 answers

Rails: carrierwave uninitialized constant error

I have Rails 3 Carrierwave 0.5.4 //app/uploaders/fasta_uploader.rb class FastaUploader < CarrierWave::Uploader::Base storage :file def store_dir 'public/data/01_fasta' end end //migration class AddFileUpToCvits <…
bdeonovic
  • 4,130
  • 7
  • 40
  • 70
22
votes
3 answers

CarrierWave: Create the same, unique filename for all versioned files

Before I go into detail I'll get right to the point: has anyone figured out a way to get Carrierwave to save files with their names as a timestamp or any arbitrary string that is unique to each file? By default Carrierwave saves each file and its…
seaneshbaugh
  • 1,448
  • 4
  • 18
  • 26
21
votes
6 answers

What's the proper way to copy a carrierwave file from one record to another?

I need to copy a file from one carrier wave object to another. They are different tables and different types of uploaders. I started with: user.avatar = image.content (where user and image are model instances, avatar and content are the carrierwave…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
21
votes
4 answers

Validate image size in carrierwave uploader

All uploads should be at least 150x150 pixels. How to validate it with Carrierwave?
Kir
  • 7,981
  • 12
  • 52
  • 69
21
votes
3 answers

CarrierWave how to store file at given url

I have CarrierWave working fine through the typical ORM setup and upload via form. I would like to figure out how to use CarrierWave outside of the form submission context. For example, when a user registers I would like to grab their gravatar and…
Marc
  • 3,812
  • 8
  • 37
  • 61
21
votes
5 answers

How to store files out side the public folder in carrierwave?

Carrierwave by default takes in the url generated by store_dir in the uploader and prepends the path to the public folder of the rails application and stores the files. For example if def store_dir "uploads/#{model.id}" end then the file is…
Avinasha Shastry
  • 822
  • 1
  • 8
  • 21
21
votes
3 answers

Configure Environment to Use File System Locally and Amazon on Heroku

I am not sure how to configure the environment such that Carrier Wave will use the local file storage when running the app locally (development) and s3 after i load to heroku (production) in Development storage :file in Production storage :s3
user663778
  • 381
  • 4
  • 14
20
votes
2 answers

Downloading and zipping files that were uploaded to S3 with CarrierWave

I have a small Rails 3.2.1 app that uses CarrierWave 0.5.8 for file uploads to S3 (using Fog) I want users to be able to select some images that they'd like to download, then zip them up and send them a zip. Here is what I've come up with: def…
Gidogeek
  • 1,277
  • 2
  • 16
  • 27
20
votes
1 answer

rspec testing carrierwave

I'm making a rails 3.1 app using carrierwave to upload files to aws s3. I've followed the instructions on the carrierwave github repository and am now able to upload files to my aws bucket. It's the testing that got me stuck. Over the last two…
BenU
  • 2,287
  • 1
  • 22
  • 35