From 0b6cafbac0e07365dd9fdef8dec5babddea2614f Mon Sep 17 00:00:00 2001 From: r888888888 Date: Fri, 7 Jun 2013 15:51:57 -0700 Subject: [PATCH] work on #364 --- app/models/post.rb | 4 ++++ app/views/posts/show.html.erb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/app/models/post.rb b/app/models/post.rb index 72bab1ae9..bb72b21e3 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -153,6 +153,10 @@ class Post < ActiveRecord::Base end module ImageMethods + def twitter_card_supported? + file_size <= 1.megabyte && image_width.to_i >= 280 && image_height.to_ >= 150 + end + def has_large? is_image? && image_width.present? && image_width > Danbooru.config.large_image_width end diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 2c1fc4de9..57d8d51ad 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -111,6 +111,12 @@ + + + <% if @post.twitter_card_supported? %> + + + <% end %> <% end %> <%= render "posts/partials/common/secondary_links" %>