Commit 531a133a by LI Daobing

add qiniu_image_path

parent f08c8be4
require "paperclip-qiniu/version" require "paperclip-qiniu/version"
require 'paperclip/storage/qiniu' require 'paperclip/storage/qiniu'
require 'paperclip/qiniu/action_view_extensions/qiniu_image_path' if defined?(ActionView)
require 'paperclip-qiniu'
module Paperclip
module Qiniu
module ActionViewExtensions
module QiniuImagePath
def qiniu_image_path(source, options={})
thumbnail = options.delete(:thumbnail)
res = source
res += "?imageMogr" if thumbnail
res += "/thumbnail/#{CGI.escape thumbnail}" if thumbnail
res.html_safe
end
end
end
end
end
ActionView::Base.send :include, Paperclip::Qiniu::ActionViewExtensions::QiniuImagePath
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment