Sha256: 7e5c4e2f36fda15fdddebd2ea27f639d5c27db1792842526c8589bc91b229d2a
Contents?: true
Size: 442 Bytes
Versions: 12
Compression:
Stored size: 442 Bytes
Contents
require 'base64' module Prawn::SVG::Loaders class Data REGEXP = %r[\A(?i:data):image/(png|jpeg);base64(;[a-z0-9]+)*,] 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 and image/jpeg data URLs" end Base64.decode64(matches.post_match) end end end
Version data entries
12 entries across 12 versions & 1 rubygems