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
19
votes
3 answers

Heroku: Running imagemagick with paperclip

I have installed image magick on my mac os x computer and now I want to deploy it to heroku. I've installed the the paperclip plugin on heroku but I get this error when uploading an image: Paperclip::CommandNotFoundError I had this error before…
devinross
  • 2,816
  • 6
  • 34
  • 34
19
votes
1 answer

How to copy a file using Paperclip

Does anyone know of a way to copy files with Paperclip using S3 for storage? Before I try to write my own, I just wanted to make sure there wasn't already a way to do this. Thanks
CalebHC
  • 4,998
  • 3
  • 36
  • 42
19
votes
1 answer

Paperclip Resize to fit a rectangular box

I have a rectangular image for example 30x800 pixels How I can scale it with paperclip to preserve the aspect ratio to a 100x100 pixel image with borders filling the empty area ? an example :…
astropanic
  • 10,800
  • 19
  • 72
  • 132
19
votes
9 answers

Paperclip renaming files after they're saved

How do I rename a file after is has been uploaded and saved? My problem is that I need to parse information about the files automatically in order to come up with the file name the file should be saved as with my application, but I can't access the…
fivetwentysix
  • 7,379
  • 9
  • 40
  • 58
19
votes
2 answers

Smarter paperclip validations

I'm using paperclip in a rails app and have the following three validations in my model validates_attachment_presence :photo validates_attachment_size :photo, :less_than=>1.megabyte validates_attachment_content_type :photo,…
stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189
18
votes
2 answers

File download using Paperclip

I am using Rails to make a small file upload app. For file attachment I am using the wonderful Paperclip but I can't work out how to do downloads. How would I create a link in my show view, that is passed the file id, for instance that would allow…
seadowg
  • 4,215
  • 6
  • 35
  • 43
18
votes
6 answers

How can I trigger a scanner from a browser?

I have Fujitsu fi-6130 TWAIN / ISIS scanners that I'd like to trigger from a button in a jQuery Rails web page. Not only would I like to have the page tell the scanner to "go", I'd also like to upload the resulting file via Paperclip once the…
Randy J Parker
  • 461
  • 1
  • 4
  • 8
18
votes
3 answers

Rails: Paperclip & previews?

You know on some sites when you're asked to upload, say, an avatar, you click on the button, select your file, then hit OK, but before you Submit the page (as in, no record is created/updated), a little preview of the image shows up? How would I…
neezer
  • 19,720
  • 33
  • 121
  • 220
18
votes
2 answers

How can I resize a Paperclip image after it has been added to the database?

I've added 2000 pictures to my images table and I'm using the Paperclip plugin to create thumbs. I'm wondering if there's a way to go through the database and add another :styles element. For example, when I added the images I had the following in…
mculp
  • 2,637
  • 1
  • 25
  • 34
17
votes
1 answer

How to do Rails migration involving Paperclip

How do people write their Rails migrations that involve Paperclip? I feel that I might be missing something obvious as I have now written my own migration helpers hacks that makes it easier and also take care of doing necessary filesystem changes.…
Mattias Wadman
  • 11,172
  • 2
  • 42
  • 57
17
votes
3 answers

Paperclip: migrating from file system storage to Amazon S3

I have a RoR website, where users can upload photos. I use paperclip gem to upload the photos and store them on the server as files. I am planning to move to Amazon S3 for storing the photos. I need to move all my existing photos from server to…
ketan jain
  • 231
  • 2
  • 7
17
votes
2 answers

Getting width and height of image in model in the Ruby Paperclip GEM

Trying to get the width and height of the uploaded image while still in the model on the initial save. Any way to do this? Here's the snippet of code I've been testing with from my model. Of course it fails on…
Corey
  • 2,453
  • 4
  • 35
  • 63
17
votes
1 answer

How to upload image, word docs and/or PDF files via Paperclip rails 4

I would like to enable users to upload Word Docs and PDF files to my rails application. My app is similar to a Pinterest app, users can create Pins where they attach a picture followed by a description (used Paperclip to attach the image to the…
Cyzanfar
  • 6,997
  • 9
  • 43
  • 81
17
votes
3 answers

Paperclip Error: model missing required attr_accessor for 'avatar_file_name'

I then want to use Paperclip to have photos for each Listing. I added the appropriate code to the listings show.html.erb, the listing.rb model, the listings_controller.rb and the _form.html.erb partial. When I try uploading an image for the Listing…
JJThaeler
  • 203
  • 1
  • 3
  • 9
16
votes
1 answer

Paperclip + Active_admin + Rails 3.0.10 multiple images

I have a crud with paperclip and multiple images' i implement active_admin and the product update fine, but, i can't not upload or edit the multiple images, the form i have is this: form :html => { :multipart => true } do |f| f.inputs "Details"…
Stanmx
  • 455
  • 5
  • 15