SEO - 페이스북 등에서 커버이미지 대신 첫째 이미지를 보여주는 문제
CMS/프레임워크 | Rhymix 1.9 |
---|---|
개발 언어 | PHP 7.2 |
SEO 커버이미지가 아니라 첫째 이미지를 보여주는 현상
<head>
...
<meta property="og:image" content="{커버이미지를 무시하고 첫째 첨부이미지 링크}">
....
</head>
/classes/display/HTMLDisplayHandler.php : 484~524
// Add image.
if ($page_type === 'article' && $permitted && config('seo.og_extract_images'))
{
if (($document_images = Rhymix\Framework\Cache::get("seo:document_images:$document_srl")) === null)
{
$document_images = array();
if ($oDocument->hasUploadedFiles())
{
foreach ($oDocument->getUploadedFiles() as $file)
{
if ($file->isvalid !== 'Y' || !preg_match('/\.(?:bmp|gif|jpe?g|png)$/i', $file->uploaded_filename))
{
continue;
}
list($width, $height) = @getimagesize($file->uploaded_filename);
if ($width < 100 && $height < 100)
{
continue;
}
$image = array('filepath' => $file->uploaded_filename, 'width' => $width, 'height' => $height);
if ($file->cover_image === 'Y')
{
array_unshift($document_images, $image);
}
else
{
$document_images[] = $image;
}
if (count($document_images) >= 1)
{
break;
}}
}
Rhymix\Framework\Cache::set("seo:document_images:$document_srl", $document_images);
}
}
else
{
$document_images = null;
}
이미지 배열의 값이 하나 이상이면 루프를 끝내라는 부분이 존재
댓글 0