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
1
vote
1 answer

Error resizing images with Paperclip after images have been added

This is the code in my model: has_attached_file :photo, :styles => { :tiny => "25x25#", :thumbnail => "50x50#", :small => "150x150>", :medium => "300x300>" }, :default_url => "/images/default_:style.jpg" I run this…
user730569
  • 3,940
  • 9
  • 42
  • 68
1
vote
2 answers

paperclip not saving attachments

I've been using paperclip and everything was fine, till my server installed Passenger and I cant make it work. I have the most simple example of :image like this: has_attached_file :image , :url =>…
1
vote
1 answer

Migrating Paperclip database to Active Storage Amazon S3

We are in the process of migrating paperclip to active storage.But we want to move Paperclip storage from database to Active Storage Amazon S3. Can anyone point me to a documentation for this? I can't seem to find one.
1
vote
1 answer

Titanium + Rails + Paperclip === NULL values?

EDIT: The real question was whether or not you can use a JSON http header, and how to format an XHR send of a file to a Rails application.
Micah Alcorn
  • 2,363
  • 2
  • 22
  • 45
1
vote
1 answer

getting text from file uploaded with paperclip

I've got a very simple file upload for a text file using paperclip. What I want to do is to get the first line of the text file and turn it into a hash I can search against in a database. I don't think it makes much sense to save the file, then…
pedalpete
  • 21,076
  • 45
  • 128
  • 239
1
vote
1 answer

ActiveStorage "id delegated to attachment, but attachment is nil"

I'm in the process of migrating from using Paperclip to now using ActiveStorage. I've ran through the migration guide provided here. I have a Logo model and a School model. A School has_one_attached :logo and a Logo belongs_to :school In the…
Chiefwarpaint
  • 643
  • 2
  • 12
  • 25
1
vote
2 answers

Is there an easy way to automatic vertical/horizontal align images with paperclip?

I always want square images of 100x100 but i dont want to scale. If the it is an image of 100X80 i want it vertical aligned with 10 white pixels on top and 10 white pixels on bottm. Is there an easy way to handle this? Using Rails 2.1 with paperclip…
Michael Koper
  • 9,586
  • 7
  • 45
  • 59
1
vote
3 answers

Ruby on Rails Avatar Paperclip::CommandNotFoundError

I've been trying to work with Paperclip. I've installed ImageMagick. I've added the line Paperclip.options[:command_path] = "/usr/local/bin" in config/initializers/paperclip.rb. But i'm still getting the error "Avatar…
user726616
  • 21
  • 1
  • 3
1
vote
1 answer

Aws::S3::Errors::InvalidArgument with S3 and paperclip

I use aws-sdk-core (3.59.0), aws-sdk-s3 (1.45.0) and paperclip (6.1.0). Here is also my S3 configs: config.paperclip_defaults = { storage: :s3, s3_region: Rails.application.secrets.s3_region, bucket:…
1
vote
1 answer

Paperclip install issues with rails 3

Installed plugin, then ran bundle install and get this... bundle install Updating git://github.com/thoughtbot/paperclip.git fatal: ambiguous argument 'rails3': unknown revision or path not in the working tree. Use '--' to separate paths from…
stewart715
  • 5,557
  • 11
  • 47
  • 80
1
vote
0 answers

How to fix 'Missing an image filename' error while try to add watermark using s3 image in paperclip

When I'm trying to upload watermark on s3 image through paperclip then it will give error like not authorised and missing an image filename because I'm using dynamic watermark URL. It is also stored in s3 photo.rb has_attached_file :image, …
1
vote
1 answer

How can I block file uploads in Rails?

I have a rails app (v4.2). I have two actions that permit an image upload using paperclip. I have paperclip validation on the mime types. Anti-malware on the server found a bunch of PHP files in /tmp like this…
Kevin Lawrence
  • 698
  • 7
  • 23
1
vote
3 answers

Finding out which photo is currently showing in a javascript slideshow

I'm using a javascript slideshow called TinySlideshow (creators' page , demo). Is there a way to tell which photo in an index is currently being shown such that I can add a context based link (e.g. a "Share this" button that allows someone to send…
luroguco
  • 11
  • 1
1
vote
0 answers

Upload images to directory with paperclip - Ruby on rails

I need to save images in this directory public/images/clients/1/events/2/banner and I need to save in my database the url of the image for example: public/images/clients/1/events/2/banner/example.png I have this code: if…
1
vote
2 answers

timing of paperclip thumbnail generation

Why exactly does paperclip execute convert when a File is assigned to the attachment instead of doing all that heavy work when save is called. This seems like it's bad: ar_obj.attachment = File.open('...') #copy file to /tmp #styles.length.times…
jsharpe
  • 2,546
  • 3
  • 26
  • 42
1 2 3
99
100