paperclip

redirection forbidden / bad uri (facebook) paperclip image

强颜欢笑 提交于 2019-12-23 03:02:11
问题 I'm trying to save a users facebook url into my db, but I get the following error. redirection forbidden: http://graph.facebook.com/1240771104/picture -> https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/t... I've referenced this question but I think he is just calling an image instead of saving it to a db with a create block. Here is my user model... def self.find_for_facebook_oauth(auth, signed_in_resource=nil) user = User.where(:provider => auth.provider, :uid => auth.uid).first if

Rails image upload security

[亡魂溺海] 提交于 2019-12-23 01:52:12
问题 Currently, I adopt Carrierwave for users to images. However, I hardly find a solution for image security, i.e. how to set image authorisation for the uploaded images to only let certain user in the same group to view? After digging Facebook's implementation, I observe that they inject these params (oh,oe, __gda_) to the image url ?oh=924eb34394&oe=55E07&__gda__=1436393492fc8bf91e1aec5 Is there any similar implementation for carrierwave or paperclip ? Thanks 回答1: I worked quite a bit with this

paperclip - test if images have been uploaded

百般思念 提交于 2019-12-23 01:19:26
问题 I have 2 models (Book & Image) class Book < ActiveRecord::Base has_many :images accepts_nested_attributes_for :images end class Image < ActiveRecord::Base belongs_to :book has_attached_file :data, :path => ":rails_root/public/system/datas/:book_id/:style/:basename.:extension", :url => "/system/datas/:book_id/:style/:basename.:extension", :styles => { :thumb => ["150x172#",:jpg], :large => ["100%", :jpg] } validates_attachment_presence :data validates_attachment_content_type :data, :content

paperclip - test if images have been uploaded

岁酱吖の 提交于 2019-12-23 01:19:07
问题 I have 2 models (Book & Image) class Book < ActiveRecord::Base has_many :images accepts_nested_attributes_for :images end class Image < ActiveRecord::Base belongs_to :book has_attached_file :data, :path => ":rails_root/public/system/datas/:book_id/:style/:basename.:extension", :url => "/system/datas/:book_id/:style/:basename.:extension", :styles => { :thumb => ["150x172#",:jpg], :large => ["100%", :jpg] } validates_attachment_presence :data validates_attachment_content_type :data, :content

cannot save image by paperclip in rails on windows 8

牧云@^-^@ 提交于 2019-12-22 12:57:20
问题 I use "paperclip", "~> 4.1" (on windows 8) to save picture to my product. I have below code: products_controller: class ProductsController < ApplicationController before_action :set_product, only: [:show, :edit, :update, :destroy] def index @products = Product.all end def show end def new @product = Product.new end def edit @product = Product.all end def create @product = Product.new(product_params) respond_to do |format| if @product.save format.html { redirect_to @product, notice: 'Product

pass file to paperclip on back end [rails]

我只是一个虾纸丫 提交于 2019-12-22 12:32:45
问题 I am using paperclip to attach multiple files to a Entry object Class Asset < ActiveRecord::Base belongs_to :entry has_attached_file :asset, ... Works wonderfully when user is uploading files via a nested form. However, I have certain instances in which a file is uploaded not via the input form but as a result of a flash audio recorder. Audio is recorded and uploaded asynchronously to my /tmp folder. So I end up with some files on my server that have not been uploaded via paperclip. In these

pass file to paperclip on back end [rails]

三世轮回 提交于 2019-12-22 12:32:31
问题 I am using paperclip to attach multiple files to a Entry object Class Asset < ActiveRecord::Base belongs_to :entry has_attached_file :asset, ... Works wonderfully when user is uploading files via a nested form. However, I have certain instances in which a file is uploaded not via the input form but as a result of a flash audio recorder. Audio is recorded and uploaded asynchronously to my /tmp folder. So I end up with some files on my server that have not been uploaded via paperclip. In these

Watermark images with paperclip, rails 4

╄→尐↘猪︶ㄣ 提交于 2019-12-22 10:43:39
问题 I've been attempting to add watermarks to my images, following the answer listed in watermark with paperclip : Watermark.rb: module Paperclip class Watermark < Processor # Handles watermarking of images that are uploaded. attr_accessor :current_geometry, :target_geometry, :format, :whiny, :convert_options, :watermark_path, :watermark_offset, :overlay, :position def initialize file, options = {}, attachment = nil super geometry = options[:geometry] @file = file @crop = geometry[-1,1] == '#'

no validates_attachment_file_name when upgrading to Paperclip 4.1 from 3.5

女生的网名这么多〃 提交于 2019-12-22 10:14:27
问题 We have code that looks like run of the mill paper clip: has_merchants_attached_file :pdf, storage: :s3, s3_credentials: Mbc::DataStore.s3_credentials, s3_permissions: :private, path: ":identifier_template.pdf", bucket: Mbc::DataStore.forms_and_templates_bucket_name validates_attachment_file_name :pdf, :matches => [/pdf\Z/] Which generates an error: undefined method `validates_attachment_file_name' for #<Class:0x007fba67d25fe0> Interestingly enough, when we down grade back to 3.5, we

Paperclip Force Download

天涯浪子 提交于 2019-12-22 08:18:54
问题 Hope anyone can help on this! Making use of Paperclip to upload Files to an Application, so two things that i need to cover. 1) What is the best way to link to the File for Download, I am currently linking to the public folder but it is not the best option as it shows the URL which i dont want. Thinking maybe a button_to call be not sure if this is build into Paperclip already. Options. 2) When above is done then the Browser needs to force to download not just open the file, or at least give