Sha256: 4302a81d0bd156627e4ecb91f73d4c39aab000da01d263f3dda1a2f1d9ed6f38

Contents?: true

Size: 459 Bytes

Versions: 30

Compression:

Stored size: 459 Bytes

Contents

module Onebox
  module Engine
    class ImageOnebox
      include Engine

      matches_regexp /^(https?:)?\/\/.+\.(png|jpg|jpeg|gif|bmp|tif|tiff)(\?.*)?$/i

      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

        "<a href='#{@url}' target='_blank'><img src='#{@url}'></a>"
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
onebox-1.5.21 lib/onebox/engine/image_onebox.rb
onebox-1.5.20 lib/onebox/engine/image_onebox.rb
onebox-1.5.19 lib/onebox/engine/image_onebox.rb
onebox-1.5.18 lib/onebox/engine/image_onebox.rb
onebox-1.5.17 lib/onebox/engine/image_onebox.rb
onebox-1.5.16 lib/onebox/engine/image_onebox.rb
onebox-1.5.14 lib/onebox/engine/image_onebox.rb
onebox-1.5.13 lib/onebox/engine/image_onebox.rb
onebox-1.5.12 lib/onebox/engine/image_onebox.rb
onebox-1.5.11 lib/onebox/engine/image_onebox.rb
onebox-1.5.10 lib/onebox/engine/image_onebox.rb
onebox-1.5.9 lib/onebox/engine/image_onebox.rb
onebox-1.5.8 lib/onebox/engine/image_onebox.rb
onebox-1.5.7 lib/onebox/engine/image_onebox.rb
onebox-1.5.6 lib/onebox/engine/image_onebox.rb
onebox-1.5.5 lib/onebox/engine/image_onebox.rb
onebox-1.5.3 lib/onebox/engine/image_onebox.rb
onebox-1.5.2 lib/onebox/engine/image_onebox.rb
onebox-1.5.1 lib/onebox/engine/image_onebox.rb
onebox-1.5.0 lib/onebox/engine/image_onebox.rb