paperclip

Easy way to do ajax uploading with paperclip in rails?

旧巷老猫 提交于 2019-12-04 03:32:04
I was wondering if there was an easy way e.g. a plugin, to do ajax uploading in rails with paperclip or am I going to have to build it from scratch? Cheers! Edit: Also, I'm looking for a non-flash solution. You can try remotipart ( http://os.alfajango.com/remotipart ). It's a gem fine integrated with Rails 3.1 and 3.0. I have tried it, and all the ajax-file-upload handled like magic. maxiperez I had this problem. Perhaps my solution is your solution Problem paperclip with ajax EDIT: You'll find two versions of ajax upload on https://github.com/apneadiving/Pic-upload---Crop-in-Ajax . Branch

Ruby on rails - paperclip not saving to database

感情迁移 提交于 2019-12-04 03:18:06
问题 I'm trying to make a create product page in rails. This includes adding multiple images. I have one model for products one for photos and for users. I'm using the paperclip gem for photo upload. But I have 2 problems. My file input is not allowing me to select multiple images When I view a product no pictures show because pictures are not being saved to database P.S. I use HAML and I dont have a photo controller. Products controller class ProductsController < ApplicationController before

How can I reduce the quality of an uploading image using Paperclip?

那年仲夏 提交于 2019-12-04 03:15:45
问题 I am running Ruby on Rails 3 and I would like to reduce the quality of an uploading image using the Paperclip plugin/gem. How can I do that? At this time in my model file I have: has_attached_file :avatar, :styles => { :thumb => ["50x50#", :jpg], :medium => ["250x250#", :jpg], :original => ["600x600#", :jpg] } that will convert images in to the .jpg format and will set dimensions. 回答1: Try using convert_options. has_attached_file :avatar, :styles => { :thumb => '50x50#' }, :convert_options =>

Secure paperclip urls only for secure pages

爱⌒轻易说出口 提交于 2019-12-04 01:46:05
I'm trying to find the best way to make paperclip urls secure, but only for secure pages. For instance, the homepage, which shows images stored in S3, is http://mydomain.com and the image url is http://s3.amazonaws.com/mydomainphotos/89/thisimage.JPG?1284314856 . I have secure pages like https://mydomain.com/users/my_stuff/49 that has images stored in S3, but the S3 protocol is http and not https, so the user gets a warning from the browser saying that some elements on the page are not secure, blah blah blah. I know that I can specify :s3_protocol in the model, but this makes everything secure

Does Paperclip automatically clean up filenames?

南楼画角 提交于 2019-12-04 01:05:32
I'm using Thoughtbot's Paperclip gem to handle file uploads. I'm finding that when I upload a file with spaces in the filename, it gets stored with the spaces replaced with underscores. That's good. I also tried uploading a file with special characters like ~ and so on and they all got replaced with underscores. Great. Exactly what I want. But why is it happening? All I'm doing in my model is... has_attached_file( file_somefile, :path => ":rails_root/public/system/other/path/elements/:basename.:extension" ) Is this Paperclip's default behavior? To add a little more information, this happens in

Can paperclip read photo geometry off an S3 bucket?

会有一股神秘感。 提交于 2019-12-04 01:05:31
I would like to read the geometry of a photo off of my S3 container. When it's on my local, this works : def photo_geometry(style = :original) @geometry ||= {} @geometry[style] ||= Paperclip::Geometry.from_file photo.path(style) end But it doesn't seem to work when I switch my model over to S3.. Any recommendations? The bigger story, is I'm trying to write some code that will allow me to retrieve photos from S3, allow users to crop them, and then reupload them back to S3 still assigned by paperclip. EDIT: This is the error that is returned : Paperclip::NotIdentifiedByImageMagickError: photos

PaperClip Error NotIdentifiedByImageMagickError when scaling images

亡梦爱人 提交于 2019-12-03 23:46:30
I have been banging my head against this for several days. Recently, my image uploader has stopped working properly. I have investigated several possibilities, but have none of the suggested solutions have worked in my case. The error message is: #<Paperclip::Errors::NotIdentifiedByImageMagickError:Paperclip::Errors::NotIdentifiedByImageMagickError> Here are the details: Mac OS X 10.8.3 ImageMagick 6.8.4-4 2013-03-29 libtool => /usr/bin/libtool Rails 3.2.13 Ruby 1.9.3p194 development.rb contains appropriate path (and I have verified that it is correct using which identify ) Paperclip.options[

Rails missing image

二次信任 提交于 2019-12-03 22:29:37
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 this? ActionController::RoutingError (No route matches "/photos/normal/missing.png"): DanneManne If you don't need any control over the default image, which I don't think you need, you can place it in any folder under RAILS_ROOT/public/images/ Just make sure you point it out in the attachment model with the :default_url parameter . So for example if you place

store images locally for development s3 for production Rails Paperclip

主宰稳场 提交于 2019-12-03 22:26:07
I want to upload images on my local machine for development but store them on my Amazon S3 account for production. upload.rb if Rails.env.development? has_attached_file :photo, :styles => { :thumb => '40x40#', :medium => '150x200>', :large => '300x300>'}, :convert_options => { :thumb => "-quality 92", :medium => "-quality 92", :large => "-quality 92" }, :processors => [:cropper] else has_attached_file :photo, :styles => { :thumb => '40x40#', :medium => '150x200>', :large => '300x300>'}, :convert_options => { :thumb => "-quality 92", :medium => "-quality 92", :large => "-quality 92" }, :storage

File upload field causing ActionController::InvalidAuthenticityToken exception

不羁岁月 提交于 2019-12-03 22:13:30
Using rails 4, and trying to add a file field to an existing form, using simple_form and paperclip. Here's the critical part of the form: <%= simple_form_for(@employee, html: { class: 'form-horizontal requires', multipart: true}, remote: true) do |f| %> <%= f.input :avatar %> <% end %> Everything works ok, unless I actually submit the form with an uploaded file. Then, I get this: ActionController::InvalidAuthenticityToken in EmployeesController#update What am I doing wrong here? The simplest solution would just be to add authenticity_token: true to your form. Like this: <%= form_for @employee,