paperclip

How to save a Canvas via Paperclip

点点圈 提交于 2019-12-06 05:14:45
I have been working with two approaches, but the goal is just to save the canvas via Paperclip. First approach Canvas to Base64 and then add base64 to params with ajax $(document).on('click', '#save_canvas', function() { var base64Data = canvas.toDataURL() $.ajax({ type: "POST", url: "pictures/", data: { base64: base64Data }, success: function(post){ console.log('success') }, error: function(post){ console.log(this) } }) }) Access params[:base64] via Paperclip.adapters_io def create @picture = Picture.new(picture_params) # ... image = Paperclip.io_adapters.for(params[:base64]) image.original

file upload progress bar with paperclip on heroku

◇◆丶佛笑我妖孽 提交于 2019-12-06 04:52:57
问题 I need to show a progress bar for file uploads and i have no idea. Any help will be appreciated. Application is on Heroku and files are on S3 回答1: I'd use jQuery file upload which doesn't require flash, only javascript and is compatible with all browser (including IE6): https://github.com/blueimp/jQuery-File-Upload I wrote the tutorial in the wiki and made a sample app here: https://github.com/apneadiving/Pic-upload---Crop-in-Ajax Using both jQuery File Upload and Uploadify (on in each branch

Issue with Paperclip/S3 in Rails 3.2.5 “cannot load such file — aws-sdk”

一世执手 提交于 2019-12-06 04:23:57
Image Uploading was working fine, but when I tried switching it to S3, it started throwing an error. I get the following error when I try to create a new image upload: cannot load such file -- aws-sdk (You may need to install the aws-sdk gem) Relevant gems: gem 'rails', '3.2.5' gem 'paperclip' gem 'aws-sdk' config/s3.yml: development: bucket: bucketname access_key_id: # secret_access_key: # test: bucket: bucketname access_key_id: # secret_access_key: # image_upload.rb: has_attached_file :image, :styles => { :normal => "1680x6000", :result => "560x3000", :thumb => "140x500" }, :path => "

paperclip accepting jpg and png on production

限于喜欢 提交于 2019-12-06 04:17:55
问题 I'm using PaperClip plugin in my Rails application as follows: has_attached_file :photo, :styles => {:small => '64X64>', :medium => '250X250>'}, :url => "/assets/user_photos/:id/:style/:basename.:extension", :path => ":rails_root/public/assets/user_photos/:id/:style/:basename.:extension" # validates_attachment_presence :photo validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png','image/gif'] validates_attachment_size :photo, :less_than => 1.megabytes It works

Rails 4: Multiple image upload using paperclip

ⅰ亾dé卋堺 提交于 2019-12-06 04:13:26
I'm looking to upload multiple images to my 'locations' model. I've called the images model 'assets'. One location has multiple assets. I'm also using paperclip to handle the uploads and nested_form to allow selecting multiple assets. Weirdly, the locations hash looks to be passing the variables correctly, but they don't appear to be being picked up by the assets model. Any help would be great! Location model class Location < ActiveRecord::Base has_many :location_post has_many :posts, :through => :location_post has_many :assets, dependent: :destroy attr_accessor :asset, :assets_attributes

Paperclip / Passenger NotIdentifiedByImageMagickError:

时光总嘲笑我的痴心妄想 提交于 2019-12-06 03:29:22
问题 When I try to upload a photo in Ruby on Rails using Paperclip on my local machine it works perfectly. When I try to upload a photo in Ruby on Rails using Paperclip on our Linux (CentOS 5.2) server with Apache and Phusion Passenger, I get: 2 errors prohibited this user from being saved There were problems with the following fields: - Avatar /tmp/stream20091026-21120-1qdbnul-0 is not recognized by the 'identify' command. - Avatar /tmp/stream20091026-21120-1qdbnul-0 is not recognized by the

Amazon S3 only accepting files with no spaces, no numbers in the title?

妖精的绣舞 提交于 2019-12-06 03:19:29
This is an odd question, but only commensurate with the strange behavior I'm seeing. My app is Rails 3/Paperclip/S3. Symptoms: All images are uploading regardless of their title. When uploading a .pdf or .doc, if the title has no spaces like my_doc.pdf, it uploads fine. When uploading a .pdf or .doc with spaces, such as My Doc.pdf, it fails, either with error broken pipe or by the file silently failing to upload to S3. When uploading a .pdf or .doc with numbers, such as mydoc20.pdf, it also fails as above. I imagine there are two possible solutions to this problem. Fix the broken pipe error

Problems installing RMagick with Paperclip in Rails 3

◇◆丶佛笑我妖孽 提交于 2019-12-06 02:14:43
I'm trying to use paperclip in rails and when I'm doing the "bundle install" I'm getting the following error: Can't install RMagick 2.13.1. Can't find Magick-config in /usr/local/mysql/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/Users/seanhinton/.rvm/bin What I'm wondering is how do I install RMagick (is that what I need?) on my machine (it's OSX 10.6)? Cheers! RMagick is a ruby adapter for ImageMagick. Getting ImageMagick is a huge pain, and it doesn't come on your computer by default. Here's the easiest way to get it: Get

Paperclip how to change basename (filename)?

断了今生、忘了曾经 提交于 2019-12-05 20:26:42
问题 I am trying to change the basename (filename) of photos: In my model I have: attr_accessor :image_url, :basename has_attached_file :image, :styles => { :original => ["300x250>", :png], :small => ["165x138>", :png] }, :url => "/images/lille/:style/:id/:basename.:extension", :path => ":rails_root/public/images/lille/:style/:id/:basename.:extension" before_save :basename private def basename self.basename = "HALLLO" end But the filename is not changed at all. 回答1: If you are assigning the file

fields for images don't displays in active admin form

你离开我真会死。 提交于 2019-12-05 20:18:42
gem "formtastic", "~> 2.1.1" gem "activeadmin", "~> 0.4.2" gem "paperclip" fields for photos don't displays in active admin form app/views/admin/products/_form.html.erb ,but the same form in app/views/products/_form.html.erb works correctly in product's views > app/admin/products.erb ActiveAdmin.register Product do form :partial => "form" end app/views/admin/products/_form.html.erb <%= semantic_form_for [:admin , @product ], :html => { :multipart => true } do |f| %> <%= f.semantic_errors :name , :price , :description, :category_id %> <%= f.inputs :new_product do%> <%= f.input :name %> <%= f