Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1944

General Questions/New to Joomla! 5.x • Re: Call Intro or Full Article Image

$
0
0
I just checked, was missed the part of clean the image URL but even without it the tag show up well.

Correction:

Code:

use Joomla\CMS\Factory; // this one can be already in your overrideuse Joomla\CMS\Uri\Uri;  // this one can be already in your overrideuse Joomla\CMS\HTML\HTMLHelper; // this one can be already in your override$document = Factory::getApplication()->getDocument();$images   = json_decode($this->item->images);$ogImg = !empty($images->image_fulltext) ? $images->image_fulltext : $images->image_intro;if ( !empty($ogImg) ) {    $ogImg = HTMLHelper::_('cleanImageURL', $ogImg);    $document->addCustomTag('<meta property="og:image" content="' . Uri::base() . $this->escape($ogImg->url) . '" />');}

Statistics: Posted by carlitorweb — Fri May 10, 2024 6:26 pm



Viewing all articles
Browse latest Browse all 1944

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>