Sha256: db56506f36753452b3784cd56beefbb28fd989eb8ddaadfa276bc1a1e7fd2d51
Contents?: true
Size: 654 Bytes
Versions: 8
Compression:
Stored size: 654 Bytes
Contents
module Onebox module Engine class ImageOnebox include Engine matches_regexp(/^(https?:)?\/\/.+\.(png|jpg|jpeg|gif|bmp|tif|tiff)(\?.*)?$/i) def always_https? WhitelistedGenericOnebox.host_matches(uri, WhitelistedGenericOnebox.https_hosts) end def to_html # Fix Dropbox image links if /^https:\/\/www.dropbox.com\/s\//.match @url @url.gsub!("https://www.dropbox.com","https://dl.dropboxusercontent.com") end escaped = Onebox::Helpers.normalize_url_for_output(url) "<a href='#{escaped}' target='_blank'><img src='#{escaped}'></a>" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems