Questions tagged [paperclip]

Paperclip is a library for the Ruby on Rails framework which makes dealing with file attachments easier. In addition to dealing with standalone files, the library provides convenience methods for creating image thumbnails. Paperclip is now deprecated - the authors recommend using ActiveStorage (they have provided a migration guide)

Paperclip is now deprecated. The library authors recommend switching to ActiveStorage. They have provided a migration guide as well.

Paperclip is intended as an easy file attachment library for ActiveRecord. The intent behind it was to keep setup as easy as possible and to treat files as much like other attributes as possible.

For more information:

4288 questions
27
votes
3 answers

How do I tell paperclip to not save the original file?

How do I tell Paperclip not to save the original file when it is uploaded? Or even better, to store a scaled version of the file as the original?
Jade
  • 1,790
  • 2
  • 18
  • 22
26
votes
7 answers

Get absolute URL for paperclip attachment

Is it possible to get the absolute URI for a Paperclip attachment? Right now, the problem is that the production environment is deployed in a sub-URI (on Passenger: RackBaseURI), but .url returns the Rails-app relative URI…
sleepy_keita
  • 1,488
  • 4
  • 17
  • 26
25
votes
8 answers

Not losing paperclip attachment when model cannot be saved due to validation error

The scenario is a normal model that contains a paperclip attachment along with some other columns that have various validations. When a form to to create an object cannot be saved due to a validation error unrelated to the attachment, columns like…
peanutbutter
  • 261
  • 3
  • 5
25
votes
5 answers

Rails Paperclip Plugin - Style Options for Resizing

So, I want to resize images to a FIXED width, but proportional height. I have been trying a wide range of operators: 380x242# 380x242> 380!x242 380x242< none of them have the desired effect. Any help? I want it to fill or resize to the 380 width,…
Jonathan Soeder
  • 847
  • 1
  • 7
  • 13
25
votes
2 answers

File upload field causing ActionController::InvalidAuthenticityToken exception

Using rails 4, and trying to add a file field to an existing form, using simple_form and paperclip. Here's the critical part of the form: <%= simple_form_for(@employee, html: { class: 'form-horizontal requires', multipart: true}, remote: true) do…
croceldon
  • 4,511
  • 11
  • 57
  • 92
24
votes
5 answers

Paperclip image uploads in Rails - Paperclip::CommandNotFoundError

I'm using paperclip to handle image uploads to rails. it worked fine on my dev OSX machine, but now on my web server I get this error: [paperclip] /Users/marky/bin/identify '-format' '%wx%h' '/tmp/stream,16451,2.JPG[0]' 2>/dev/null [paperclip] An…
Marky
  • 1,294
  • 1
  • 18
  • 40
24
votes
4 answers

Unit testing paperclip uploads with Rspec (Rails)

Total Rspec noob here. Writing my first tests tonight. I've got a model called Image. Using paperclip I attach a file called photo. Standard stuff. I've run the paperclip generator and everything works fine in production and test modes. Now…
stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189
23
votes
5 answers

Save a Prawn PDF as a Paperclip attachment?

I'm using Prawn and Prawnto to display a PDF-based reports to the user, but in some circumstances, I'd also like to save the PDF as an attachment to one of my models. I'm using Paperclip for all of my attachments. Does anyone have any suggestions on…
Adam Albrecht
  • 6,680
  • 4
  • 31
  • 35
23
votes
8 answers

How do I find an image on a page with Cucumber / Capybara in Rails 3

I am using Cucumber / Capybara with Rails 3 and am trying to validate the existence of an image after upload. I'm not sure how to check the url of the image to validate it. I have the following scenario: Scenario: Create new listing Given I am…
Jamis Charles
  • 5,827
  • 8
  • 32
  • 42
23
votes
3 answers

Rails 3, paperclip + S3 - Howto Store for an Instance and Protect Access

I have a Rails 3 app with paperclip, with the intent to store data on S3. In the app, Users belong to an instance. I would like the data stored across all the models per instance. And would like to prevent a user from Instance A from accessing, or…
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
23
votes
4 answers

heroku paperclip weird error Paperclip::Errors::MissingRequiredValidatorError

I've deployed a rails app to heroku, it was working just fine until I changed domains, locally it works fine and now I've started getting the following error: Paperclip::Errors::MissingRequiredValidatorError. the s3 env variables are set on heroku…
Itai Sagi
  • 5,537
  • 12
  • 49
  • 73
23
votes
11 answers

PaperClip Error NotIdentifiedByImageMagickError when scaling images

I have been banging my head against this for several days. Recently, my image uploader has stopped working properly. I have investigated several possibilities, but have none of the suggested solutions have worked in my case. The error message is:…
humbledaisy
  • 373
  • 1
  • 3
  • 12
22
votes
4 answers

How to retrieve EXIF information of an image in Rails

I am using Rails paperclip for displaying the images in my page. I want to know how to retrieve EXIF information of an image(like dimensions, camera model,height,width., etc).Can any one help me out??? Thanks!!!
21
votes
3 answers

store images locally for development s3 for production Rails Paperclip

I want to upload images on my local machine for development but store them on my Amazon S3 account for production. upload.rb if Rails.env.development? has_attached_file :photo, :styles => { :thumb => '40x40#', :medium => '150x200>', :large =>…
chell
  • 7,646
  • 16
  • 74
  • 140
21
votes
2 answers

Heroku + Paperclip + Amazon S3 - Pricing?

Since Heroku is a read-only filesystem I can't use paperclip to store a small quantity of files on the server. Database image storage is an option, but not particularly ideal since that may crank my client's DB size up from a few hundred KB to over…
nzifnab
  • 15,876
  • 3
  • 50
  • 65