Sha256: 521672b3f340690fd93db7d6bb61b4fcc9f5e5b5bcc276b49641fd570d4e2e80
Contents?: true
Size: 917 Bytes
Versions: 1
Compression:
Stored size: 917 Bytes
Contents
module Paperclip module Qin module ActionViewExtensions module QiniuImageTag def qiniu_image_tag(source, options={}) options.symbolize_keys! src = path_to_image(source) options[:src] = qiniu_image_path(src, options) unless src =~ /^(?:cid|data):/ || src.blank? options[:alt] = options.fetch(:alt){ image_alt(src) } end if size = options.delete(:size) options[:width], options[:height] = size.split("x") if size =~ %r{^\d+x\d+$} end if mouseover = options.delete(:mouseover) options[:onmouseover] = "this.src='#{path_to_image(mouseover)}'" options[:onmouseout] = "this.src='#{options[:src]}'" end tag("img", options) end end end end end ActionView::Base.send :include, Paperclip::Qiniu::ActionViewExtensions::QiniuImageTag
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paperclip-new-qiniu-0.1.2 | lib/paperclip/qin/action_view_extensions/qiniu_image_tag.rb |