Sha256: 9bd6de68f8de6c1d73e67a54bda50b022e996ea87a2228cdb75fd4d3b0088273
Contents?: true
Size: 799 Bytes
Versions: 1
Compression:
Stored size: 799 Bytes
Contents
if defined?(Paperclip) module Paperclip class Attachment def inline_data(style=:original) if queued_for_write[style] queued_for_write[style].read.force_encoding("UTF-8").html_safe rescue "" elsif !path(style).blank? and File.exists?(path(style)) File.read(path(style)).force_encoding("UTF-8").html_safe rescue "" end end def base64(style=:original) _data = inline_data(style) Base64.encode64(_data) if _data end def base64_as_src(style=:original) _base64 = base64(style) "data:#{content_type};base64,#{_base64}" unless _base64.blank? end def inline_svg inline_data if svg? end def svg? !!(content_type =~ /svg/) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hancock_cms_gallery-1.0.2 | lib/hancock/gallery/paperclip_patch.rb |