diff --git a/app/controllers/page_contents_controller.rb b/app/controllers/page_contents_controller.rb index 95e6df5..12d7a84 100644 --- a/app/controllers/page_contents_controller.rb +++ b/app/controllers/page_contents_controller.rb @@ -30,12 +30,14 @@ class PageContentsController < OrbitAdminController img_src_path = File.join('public', img_src) img_src_path = URI.decode(img_src_path) if File.exist?(img_src_path) - image = MiniMagick::Image.open(img_src_path) - if image[:width] - metas << {"property" => "og:image:width", "content" => image[:width].to_s} - end - if image[:height] - metas << {"property" => "og:image:height", "content" => image[:height].to_s} + image = MiniMagick::Image.open(img_src_path) rescue nil + if image + if image[:width] + metas << {"property" => "og:image:width", "content" => image[:width].to_s} + end + if image[:height] + metas << {"property" => "og:image:height", "content" => image[:height].to_s} + end end end else