拡張子がpngの場合に対応

This commit is contained in:
eai04191 2019-01-14 23:50:15 +09:00
parent 3dedb57fe4
commit dcf31865a1
1 changed files with 3 additions and 2 deletions

View File

@ -26,11 +26,12 @@ class FantiaResolver implements Resolver
// 投稿に画像がない場合ogp.jpgでない場合のみ大きい画像に変換する
if($ogpUrl != "http://fantia.jp/images/ogp.jpg"){
preg_match("~https://fantia\.s3\.amazonaws\.com/uploads/post/file/{$postId}/ogp_(.*?).jpg~", $ogpUrl, $match);
preg_match("~https://fantia\.s3\.amazonaws\.com/uploads/post/file/{$postId}/ogp_(.*?)\.(jpg|png)~", $ogpUrl, $match);
$uuid = $match[1];
$extension = $match[2];
// 大きい画像に変換
$metadata->image = "https://c.fantia.jp/uploads/post/file/{$postId}/main_{$uuid}.jpg";
$metadata->image = "https://c.fantia.jp/uploads/post/file/{$postId}/main_{$uuid}.{$extension}";
}
return $metadata;