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

paperclip callbacks or simple processor?

I wanted to run the callback after_post_process but it doesn't seem to work in Rails 3.0.1 using Paperclip 2.3.8. It gives an error: undefined method `_post_process_callbacks' for # I want to call the Panda API after the file…
holden
  • 13,471
  • 22
  • 98
  • 160
21
votes
4 answers

ruby copy a paperclip attachment from one model to another?

I have two models like this:- Model 1 - card - contains a representation of data of interest for front page attachment name = cardimage Model 2 - user - contains the user attachment name = avatar When I create! a new card, I want the avatar…
Gary
  • 1,917
  • 3
  • 19
  • 19
20
votes
5 answers

Plupload Automatically start upload when files added

When files are added i want to start the upload process automatically. I called the start function at the end of FilesAdded but it doesn't start the upload. uploader.bind('FilesAdded', function(up, files) { var str = ""; for (var i in…
Abid
  • 7,149
  • 9
  • 44
  • 51
20
votes
2 answers

Rails Paperclip how to use filter options of ImageMagick?

I recently implemented Paperclip with Rails and want to try out some of the filter options from ImageMagick such as blur. I've not been able to find any examples of how to do this. Does it get passed through :style as another option? :styles => {…
jyoseph
  • 5,435
  • 9
  • 45
  • 64
20
votes
1 answer

Rails missing image

I am currently using paperclip to upload images to my rails app. This is probably a very simple fix but how or where do I save the missing images to? This is the error that is produced from not having any missing images. How do I change…
morcutt
  • 3,739
  • 8
  • 30
  • 47
20
votes
2 answers

AWS S3 integration yields undefined method `match'

I'm working on a simple project using Paperclip to upload images. Everything has been working just fine until I attempted to integrate S3 with Paperclip. Upon 'uploading' a user's image I get a NoMethodError (undefined method 'match' for…
PSCampbell
  • 858
  • 9
  • 27
20
votes
12 answers

Failing to install Nokogiri gem

I'm working on a rails app that allows for image attachments to each use account. I'm using paperclip and amazon web services: gem 'paperclip' gem 'aws-sdk' When I run bundle install, I get this message: extconf failed, exit code 1 Gem files will…
Katie H
  • 2,283
  • 5
  • 30
  • 51
20
votes
3 answers

File upload with Sinatra

I am trying to be able to upload files with Sinatra. I have the code here, but I'm getting the error "method file_hash does not exist" (see /lib/mvc/helpers/helpers.rb). What is going on here? Is there some dependency I'm missing.
Ethan Turkeltaub
  • 2,931
  • 8
  • 30
  • 45
20
votes
2 answers

Rails file upload (paperclip) on edit

I made myself a simple rails blogging-type app where I use Paperclip to upload image files.I have everything working fine and dandy. I even have it hooked up to an S3 bucket, etc. Spiffy right? But I can't figure what to do when EDITING/UPDATING a…
Dennis Best
  • 3,614
  • 3
  • 20
  • 31
20
votes
1 answer

Upload CSV file in Rails and process records to display on page without saving file?

I am in the process of learning Rails and am trying to create a file upload page to process CSV data without any use of my database or model. I am also trying to avoid using any gems such as Paperclip or Carrier-wave. I have made some progress, but…
Horse Voice
  • 8,138
  • 15
  • 69
  • 120
19
votes
3 answers

How to validate file content type to pdf, word, excel, and plain text for paperclip?

In my model: has_attached_file :uploaded_file, :url => "/policy_documents/get/:id", :path => "/public/policy_documents/:id/:basename.:extension" validates_attachment_size :uploaded_file,…
Ravindra
  • 1,039
  • 2
  • 12
  • 26
19
votes
1 answer

Resize original image in Paperclip

Paperclip stores original images in "original" folder. Is there a way to resize the original images? I want to make the originals smaller in order to save the disc space. So, for example, if visitor uploads a photo with 2592x1936 I want to store it…
Evgenii
  • 36,389
  • 27
  • 134
  • 170
19
votes
3 answers

Generating Paperclip image uploads with fake data - Ruby on Rails Populator / Faker Gems

I am currently trying to populate a development database on a project with a bunch of fake data, to simulate how it will look and operate with hundreds of articles / users. I looked into different gems to do the task - such as Factory Girl, but…
Shannon
  • 2,744
  • 3
  • 28
  • 37
19
votes
4 answers

Preventing Paperclip from deleting/overwriting attachments on update

I'm having a hard time figuring out how to prevent Paperclip from deleting the old version of an attachment (image). I have a model, Site, which has an attachment, logo. I would like to keep the old logos around since I will be keeping track of…
simonwh
  • 1,017
  • 8
  • 21
19
votes
4 answers

rails - Paperclip file name

using rails with Paperclip, I can use the following to get the filename during a before_create: extension = File.extname(photo_file_name).downcase How do I get JUST the file name.. Right now I have photo_file_name which provides the entire file,…
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012