fix svg file cannot open error, just skip get width or height
This commit is contained in:
parent
f682f99975
commit
8850d99824
|
@ -30,7 +30,8 @@ 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
|
||||||
if image[:width]
|
if image[:width]
|
||||||
metas << {"property" => "og:image:width", "content" => image[:width].to_s}
|
metas << {"property" => "og:image:width", "content" => image[:width].to_s}
|
||||||
end
|
end
|
||||||
|
@ -38,6 +39,7 @@ class PageContentsController < OrbitAdminController
|
||||||
metas << {"property" => "og:image:height", "content" => image[:height].to_s}
|
metas << {"property" => "og:image:height", "content" => image[:height].to_s}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
res = get_response(URI.parse(img_src))
|
res = get_response(URI.parse(img_src))
|
||||||
image = IMG_INFO[img_src]
|
image = IMG_INFO[img_src]
|
||||||
|
|
Loading…
Reference in New Issue