Skip to content

Commit

Permalink
Embed gifv with iframe.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Jan 14, 2017
1 parent 417eef1 commit 5f6cfb6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/initializers/05-string.rb
Expand Up @@ -232,6 +232,8 @@ def embed_html(request=nil)
"<iframe width='300' height='380' src='https://embed.spotify.com/?uri=spotify:#{path.gsub("/",":")}' frameborder='0' scrolling='no' allowfullscreen></iframe>"
elsif %r{^https?://(?:www\.)?giphy\.com/gifs/(?:.*-)?(?<id>[0-9a-zA-Z]+)(/|\?|&|#|$)} =~ self
"<img src='https://i.giphy.com/#{id}.gif'>"
elsif %r{^https?://[a-z0-9\-._~:/?#\[\]@!$&'()*+,;=]+\.gifv}i =~ self
"<iframe width='640' height='538' src='#{self.https}' frameborder='0' scrolling='no' allowfullscreen></iframe>"
elsif %r{^https?://[a-z0-9\-._~:/?#\[\]@!$&'()*+,;=]+\.(?:gif|jpg|png)(?::large)?}i =~ self
"<img src='#{self.https}'>"
elsif %r{^https?://[a-z0-9\-._~:/?#\[\]@!$&'()*+,;=]+\.mp4}i =~ self
Expand Down

0 comments on commit 5f6cfb6

Please sign in to comment.