Frontend\Core\Engine\Header::extractOpenGraphImages PHP Méthode

extractOpenGraphImages() public méthode

Extract images from content that can be added add Open Graph image
public extractOpenGraphImages ( string $content )
$content string The content (where from to extract the images).
    public function extractOpenGraphImages($content)
    {
        $matches = array();
        // check if any img-tags are present in the content
        if (preg_match_all('/<img.*?src="(.*?)".*?\\/>/i', $content, $matches)) {
            // loop all found images and add to Open Graph metadata
            foreach ($matches[1] as $image) {
                $this->addOpenGraphImage($image);
            }
        }
    }