paperclip

Multiple upload with Paperclip in ror

让人想犯罪 __ 提交于 2019-11-30 16:27:08
I am using paperclip to upload one photo for one building. http://www.youtube.com/watch?v=KGmsaXhIdjc i have done it with this way. But know I decide to upload many photos to one building. Can I do that with paperclip or have to change it and use jQuery ? And if I can how ? Ps: if needed I will upload my code. ps: i am thinking to make 2 more columns in database for photo2 and photo 3 .. btw i have see all generates assets to do that. the think is that i have make it with different way to upload 1 photo. this means i have to change the all thing? update 1: in routes.rb resources :buildings do

AWS Api Gateway as a HTTP Proxy is currupting binary uploaded image files

末鹿安然 提交于 2019-11-30 16:12:31
问题 I have a ruby on rails app that takes an image file, "attaches it to a member", and uploads it to s3. When I use insomnia and POST directly to the app ... it works , however when I use the exact same endpoint behind AWS Api Gateway, the image is corrupt and not viewable. Here is the comparison of the requests. LEFT = directly posted to the rails app RIGHT = through api gateway https://www.diffchecker.com/wwUmpB5W Something I noticed, is that the paperclip gem is running different commands. It

Ruby on Rails, Paperclip: “identify” command working in cmd but not in app

自古美人都是妖i 提交于 2019-11-30 15:54:56
I've installed ImageMagick on my Windows 7 64bit and I have the Paperclip Gem. My User model looks like this: class User < ActiveRecord::Base # Paperclip has_attached_file :photo, :styles => { :thumb=> "100x100#", :small => "150x150>" } end In paperclip.rb and development.rb I have: Paperclip.options[:command_path] = 'C:/Program Files/ImageMagick-6.6.7-Q16' My _form looks like this: <%= form_for(@user, :html => { :multipart => true } ) do |f| %> <% if @user.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>

Paperclip files get deleted after each deploy

巧了我就是萌 提交于 2019-11-30 15:51:57
问题 I use the Paperclip gem to store pictures, and on localhost it works perfectly. However, any pictures I add to my live app get deleted after every deploy. I use Git to deploy. Here's my deployment process: $ bundle exec cap production deploy $ ssh root@xx.xxx.xx.xxx $ chmod -R 777 /rails_apps/app/releases $ cd /rails_apps/app/current $ cp config/database.yml.sample config/database.yml $ RAILS_ENV=production bundle exec rake assets:precompile $ /etc/init.d/apache2 restart Has anyone else run

Paperclip files get deleted after each deploy

我怕爱的太早我们不能终老 提交于 2019-11-30 15:26:22
I use the Paperclip gem to store pictures, and on localhost it works perfectly. However, any pictures I add to my live app get deleted after every deploy. I use Git to deploy. Here's my deployment process: $ bundle exec cap production deploy $ ssh root@xx.xxx.xx.xxx $ chmod -R 777 /rails_apps/app/releases $ cd /rails_apps/app/current $ cp config/database.yml.sample config/database.yml $ RAILS_ENV=production bundle exec rake assets:precompile $ /etc/init.d/apache2 restart Has anyone else run into something like this? UPDATE: This is not a duplicate, because the answer to this question , which

Paperclip and xhr.sendAsBinary

丶灬走出姿态 提交于 2019-11-30 15:26:12
问题 I use paperclip to add a file to my model. I want to use the new feature of firefox 3.6, xhr.sendAsBinary , to send a file with an ajax request. Here is how I build my request : var xhr = new XMLHttpRequest(); xhr.open("POST", "/photos?authenticity_token=" + token + "&photo[name]=" + img.name + "&photo[size]=" + img.size); xhr.overrideMimeType('text/plain; charset=x-user-defined-binary'); xhr.sendAsBinary(bin); name and size are saved in my model without problem but the file itself is not

paperclip working in development but not working in production?

核能气质少年 提交于 2019-11-30 14:07:57
I'm pretty new to rails and seem to be having an issue with the paperclip gem. I installed the gem and it works well in development (localhost:3000) but when I'm running it on the heroku server, for some reason it does not want to attach files, and the app breaks (error 500 page). Here is the process i ran... I pushed my file to heroku, heroku ran rake db:migrate (to add paperclip migrations), and then I ran heroku restart (to restart the app with new migrations). This did not seem to help. Here is the code that I have for paperclip: user.rb model: has_attached_file :avatar, :styles => {:small

Use paperclip for saving base64 images obtained from an api

孤街浪徒 提交于 2019-11-30 13:57:55
问题 I have a Photo model with an image attribute. The image contains a base64 string obtained from an api. I need to run an after_create callback and I was thinking I could use Paperclip for saving the image to the disk in the callback as it would save me some work implementing the folder structure in the public folder and generating thumbnails. Is there an easy way to do that? 回答1: To answer my own question, here is what I've come up with: class Photo < ActiveRecord::Base before_validation :set

Ruby on Rails, Paperclip, Amazon AWS S3 & Heroku

时光怂恿深爱的人放手 提交于 2019-11-30 13:31:42
问题 I try for two days to make my all web site work on the internet through Heroku and Amazon AWS S3 ( to store my images ) but ... I can't make it ! To make it simplier, I would like to use Heroku and Amazon AWS S3 with paperclip just to upload a picture and show it. I followed a lot of tutorial but, this one sum up all I did : https://devcenter.heroku.com/articles/paperclip-s3 The upload system work well with the basic storage in local but if I follow the tutorial and put this code in my

Get server file path with Paperclip

谁都会走 提交于 2019-11-30 13:11:39
问题 I'm using Rails with Paperclip to make a small file upload app. I would like to be able to return the file path on the server of the uploaded file once its done but I can't seem to work out how to get the path? Paperclip only seems to record the name of the file itself. Does anybody now how to do this? 回答1: Assuming you had an attachment called avatar on an instance of a user, you can use user.avatar.path to get the full path of the file on the filesystem, and you can use user.avatar.url to