mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-09 10:22:51 +03:00
Reviewed #2393, Removed image guessing and added testing
For review of meta tag additions as per PR #2393. This commit removes any image guesswork and only uses images that have been set by the author for the specific content. This also adds tests to cover the expected OG tags.
This commit is contained in:
@@ -367,18 +367,4 @@ class PageContent
|
||||
$doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
|
||||
return $doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve first image in page content and return the source URL.
|
||||
*/
|
||||
public function fetchFirstImage()
|
||||
{
|
||||
$htmlContent = $this->page->html;
|
||||
|
||||
$dom = new \DomDocument();
|
||||
$dom->loadHTML($htmlContent);
|
||||
$images = $dom->getElementsByTagName('img');
|
||||
|
||||
return $images->length > 0 ? $images[0]->getAttribute('src') : null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user