Sha256: 2dec500852da1b29a63a1424471139134f8871c0e278bba84598e400a5286fe1
Contents?: true
Size: 455 Bytes
Versions: 2
Compression:
Stored size: 455 Bytes
Contents
module Prawn::SVG::Loaders class Data REGEXP = %r{\Adata:image/(png|jpeg|svg\+xml);base64(;[a-z0-9]+)*,}i def from_url(url) return if url[0..4].downcase != 'data:' matches = url.match(REGEXP) if matches.nil? raise Prawn::SVG::UrlLoader::Error, 'prawn-svg only supports base64-encoded image/png, image/jpeg, and image/svg+xml data URLs' end matches.post_match.unpack1('m') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prawn-svg-0.34.2 | lib/prawn/svg/loaders/data.rb |
prawn-svg-0.34.1 | lib/prawn/svg/loaders/data.rb |