fix svg file cannot open error, just skip get width or height
This commit is contained in:
parent
f682f99975
commit
8850d99824
|
@ -30,12 +30,14 @@ class PageContentsController < OrbitAdminController
|
||||||
img_src_path = File.join('public', img_src)
|
img_src_path = File.join('public', img_src)
|
||||||
img_src_path = URI.decode(img_src_path)
|
img_src_path = URI.decode(img_src_path)
|
||||||
if File.exist?(img_src_path)
|
if File.exist?(img_src_path)
|
||||||
image = MiniMagick::Image.open(img_src_path)
|
image = MiniMagick::Image.open(img_src_path) rescue nil
|
||||||
if image[:width]
|
if image
|
||||||
metas << {"property" => "og:image:width", "content" => image[:width].to_s}
|
if image[:width]
|
||||||
end
|
metas << {"property" => "og:image:width", "content" => image[:width].to_s}
|
||||||
if image[:height]
|
end
|
||||||
metas << {"property" => "og:image:height", "content" => image[:height].to_s}
|
if image[:height]
|
||||||
|
metas << {"property" => "og:image:height", "content" => image[:height].to_s}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue