From f134cbefa800527304f975555126d27c6809ef8b Mon Sep 17 00:00:00 2001 From: eai04191 Date: Mon, 14 Jan 2019 23:08:37 +0900 Subject: [PATCH] =?UTF-8?q?=E6=8A=95=E7=A8=BF=E3=81=AB=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E3=81=8C=E3=81=AA=E3=81=84=E5=A0=B4=E5=90=88=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/MetadataResolver/FantiaResolver.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/MetadataResolver/FantiaResolver.php b/app/MetadataResolver/FantiaResolver.php index 8e95bba..85584a3 100644 --- a/app/MetadataResolver/FantiaResolver.php +++ b/app/MetadataResolver/FantiaResolver.php @@ -24,11 +24,14 @@ class FantiaResolver implements Resolver $node = $xpath->query("//meta[@property='twitter:image']")->item(0); $ogpUrl = $node->getAttribute('content'); - preg_match("~https:\/\/fantia\.s3\.amazonaws\.com\/uploads\/post\/file\/{$postId}\/ogp_(.*?).jpg~", $ogpUrl, $match); - $uuid = $match[1]; + // 投稿に画像がない場合(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); + $uuid = $match[1]; - // 大きい画像に変換 - $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}.jpg"; + } return $metadata; } else {