Hello,
I am trying to display an image from a rss in ticker. I get the title and description correctly but impossible to get the image. Could you help me please ?
Thanks a lot.
Link : Actualité - www.rem.be
Hello,
I am trying to display an image from a rss in ticker. I get the title and description correctly but impossible to get the image. Could you help me please ?
Thanks a lot.
Link : Actualité - www.rem.be
Hi All,
Do you have any idea please ? COuld you help me ?
THanks a lot
Hello Jeremy,
first of all I’ve not solved your issue yet.
Having a look to your feed https://www.lunion.fr/rss/119/cible_principale using this Website https://codebeautify.org/rssviewer/ I’ve seen that the image is into markup media:content as attribute “url”).
So I did a look, again ‘quick’) of “RssProvider.php” (found in /var/www/cms/lib/Widget inside the docker container xibo-web) that should take care of RSS parsing.
This part is related to images fetching:
// Where should we get images?
$imageSource = $dataProvider->getProperty('imageSource', 'enclosure');
$imageTag = match ($imageSource) {
'mediaContent' => 'media:content',
'image' => 'image',
'custom' => $dataProvider->getProperty('imageSourceTag', 'image'),
default => 'enclosure'
};
$imageSourceAttribute = null;
if ($imageSource === 'mediaContent') {
$imageSourceAttribute = 'url';
} else if ($imageSource === 'custom') {
$imageSourceAttribute = $dataProvider->getProperty('imageSourceAttribute', null);
}
Successivamente viene salvato l’articolo e con l’immagine:
// Do we have an image included?
$link = null;
if ($imageTag === 'enclosure') {
if (stripos($item->getEnclosureType(), 'image') > -1) {
$link = $item->getEnclosureUrl();
}
} else {
$link = $item->getTag($imageTag, $imageSourceAttribute)[0] ?? null;
}
if (!(empty($link))) {
$article->image = $dataProvider->addImage('ticker_' . md5($link), $link, $expiresImage);
} else {
$this->getLog()->debug('fetchData: no image found for image tag using ' . $imageTag);
}
if ($dataProvider->getProperty('decodeHtml') == 1) {
$article->content = htmlspecialchars_decode($article->content);
}
mbut I’ve not understood if it works properly, I should have a look with ChatGPT.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.