Skip to content

Instantly share code, notes, and snippets.

@xander-miller
Created February 8, 2014 15:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xander-miller/8885176 to your computer and use it in GitHub Desktop.
Save xander-miller/8885176 to your computer and use it in GitHub Desktop.
Using Embedly to generate preview thumbnails for bookmark links.
#method for your app/models/bookmark.rb
def thumbnail_url
Embedly::API.new.oembed( url: self.url).first.thumbnail_url
end
<!-- for your app/views/bookmarks/index.html.erb -->
<%= link_to image_tag(bookmark.thumbnail_url), bookmark.url %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment