Class: Onebox::Engine::ImageOnebox
- Inherits:
-
Object
- Object
- Onebox::Engine::ImageOnebox
- Includes:
- Onebox::Engine
- Defined in:
- lib/onebox/engine/image_onebox.rb
Constant Summary
Constants included from Onebox::Engine
Instance Attribute Summary
Attributes included from Onebox::Engine
#errors, #options, #timeout, #uri, #url
Instance Method Summary collapse
Methods included from Onebox::Engine
all_iframe_origins, engines, included, #initialize, origins_to_regexes, #placeholder_html
Instance Method Details
#always_https? ⇒ Boolean
10 11 12 |
# File 'lib/onebox/engine/image_onebox.rb', line 10 def always_https? AllowlistedGenericOnebox.host_matches(uri, AllowlistedGenericOnebox.https_hosts) end |
#to_html ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/onebox/engine/image_onebox.rb', line 14 def to_html # Fix Dropbox image links if @url[/^https:\/\/www.dropbox.com\/s\//] @url.sub!("https://www.dropbox.com", "https://dl.dropboxusercontent.com") end escaped_url = ::Onebox::Helpers.normalize_url_for_output(@url) <<-HTML <a href="#{escaped_url}" target="_blank" rel="noopener" class="onebox"> <img src="#{escaped_url}"> </a> HTML end |