paperclip

Why are RackMultipart* files persisting in my Rails /tmp directory?

大兔子大兔子 提交于 2019-12-03 03:24:18
I'm using Paperclip (2.3) to handle image uploads on a Rails 3.0.3 app running on Ubuntu. Paperclip is handling the uploads as advertised BUT the RackMultipart* files that are created in the application's /tmp folder persist -- that is, they simply accumulate rather than deleting themselves. I realize that I could use tmpreaper to delete old tmpfiles but I'd really like to find a more elegant (and scalable) solution. I had a previous issue with temp files (i.e. RackMultipart* files) accumulating in the Rails app's root directory (instead of in /tmp). I resolved this by explicitly setting the

Saving the images Dimensions (width and height) in Paperclip?

你说的曾经没有我的故事 提交于 2019-12-03 02:54:12
问题 Any Paperclip wizards out there know if you can when using Paperclip to save an image, also save the image dimensions (width and height) in 2 extra fields? How do you get such data during the Paperclip upload process? 回答1: Just for the sake of completeness, even though previous answers already show good enough suggestions. You can utilize Paperclip event handlers instead of Rails callbacks. In this case, size will be recalculated only when image changes. (If you're using S3 for storage, this

“missing required :bucket option” for Paperclip/S3

徘徊边缘 提交于 2019-12-03 02:47:15
In my Rails app I'm letting users upload an image when they create a "release", and it should upload directly to S3. I'm getting the following error in both development and production. EDIT: I should note that this error happens when trying to upload from the release edit page on form submit. ArgumentError in ReleasesController#update missing required :bucket option Rails.root: /Users/jasondemeuse/pressed I've done this before with no issues using Carrierwave, but can't figure out what I'm doing wrong now that I'm using Paperclip. All of the fixes I've seen on SO and elsewhere are heroku

Paperclip Resize to fit a rectangular box

爱⌒轻易说出口 提交于 2019-12-03 02:46:49
问题 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 : http://www.imagemagick.org/Usage/thumbnails/pad_extent.gif 回答1: has_attached_file :image, :styles => { :thumb => "100x100>" }, :convert_options => {:thumb => "-gravity center -extent 100x100"} Or with not white background has_attached_file :image, :styles => { :thumb => "100x100>" }, :convert_options =>

Rails Paperclip how to use filter options of ImageMagick?

假如想象 提交于 2019-12-03 02:46:32
问题 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 => { :medium => "300x300#", :thumb => "100x100#" } @plang's answer was correct but I wanted to give the exact solution to the blur, just in case someone was looking and found this question: :convert_options => { :all => "-blur 0x8" } // -blur {radius}x

Rails - Paperclip validating attachment size when it shouldn't be?

旧街凉风 提交于 2019-12-03 02:35:49
I've got a rails model using Paperclip that looks like this: has_attached_file :image, :styles => { :normal => ['857x392#', :png] }, :url => '/assets/pages/:id/:basename.:extension', :path => ':rails_root/public/assets/pages/:id/:basename.:extension' validates_attachment_size :image, :less_than => 2.megabytes When attempting to create a record of this model without an attachment to upload, the validation error is returned: There were problems with the following fields: * Image file size file size must be between 0 and 2097152 bytes. I've tried passing both :allow_blank => true and :allow_nil =

Saving files using Paperclip without upload

别说谁变了你拦得住时间么 提交于 2019-12-03 02:18:14
问题 I had a quick question. Is it possible to save a file without actually uploading it through a form? For example, let's say I'm looking at attachments from emails, and I want to save them using a paperclip. How do I do this? Do I manually have to call a save_file(or something similar) somewhere? Any help would be much appreciated! 回答1: I have a rake task that loads images (client logos) from a directory directly onto parperclip. You can probably adapt it to your needs. This is my simplified

Paperclip: upload from url with extension

余生颓废 提交于 2019-12-03 02:14:38
I would like to upload pictures from URLs by paperclip on S3 storage. I work with : Ruby 1.9.3 Rails 3.2.6 paperclip 3.1.3 aws-sdk 1.3.9 I have my Picture Model: class Asset has_attached_file :asset, :styles => {:thumb => "60x60>"}, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => "/pictures/:id/:style.:extension" validates_attachment_content_type :asset, :content_type => ['image/gif', 'image/jpeg', 'image/png', 'image/x-ms-bmp'] end So basically I made this to download my file from an URL: picture = Asset.new(asset: open("http://www.my_url.com/my_picture.jpg"))

How Can I Trigger a Scanner from a Browser?

社会主义新天地 提交于 2019-12-03 01:41:56
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 (single) page is scanned - ideally without requiring the user to navigate a file explorer widget to find the file manually. Each scanner is usb attached to a Windows XP desktop, though we may replace these call center desktops with Google Chrome OS. This question was asked almost a year ago, but mainly received suggestions requiring the use of commercial

How to thumbnail a multi-page pdf with paperclip

我是研究僧i 提交于 2019-12-03 00:35:29
I'd like to have Paperclip create 2 thumbnails for each page of a multipage PDF file that is uploaded. I'm running Paperclip 2.3.1.1 and using this in my Asset model: has_attached_file :asset, :styles => { :medium => "800x600>", :thumb => "100x100>" } So, when I upload a 3 page pdf file, I was hoping this would create 2 thumbs per page (one at 800x600 and a smaller image at 100x100). Instead, I get a 3 folders created (thumb, medium, original) - the original folder contains the origianl pdf file, while thumb and medium each contain a pdf with just the first page of the pdf all pixelated. What