Skip to content

Commit

Permalink
The Image libary can not handle remote images.
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed Sep 1, 2020
1 parent ba795fb commit 9be7282
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions joomlarrssb.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,13 @@ public function onContentAfterTitle($context, &$article, &$params, $page)
{
$document->setMetaData('og:image', $imageOg, 'property');

$imageInfo = Image::getImageFileProperties($imageOg);
$document->setMetaData('og:image:width', $imageInfo['width'], 'property');
$document->setMetaData('og:image:height', $imageInfo['height'], 'property');
$document->setMetaData('og:image:type', $imageInfo['mime'], 'property');
// The Image libary can not handle remote images.
$imageForInfo = str_replace(Uri::root(), '', $imageOg);
$imageInfo = Image::getImageFileProperties($imageForInfo);

$document->setMetaData('og:image:width', $imageInfo->width, 'property');
$document->setMetaData('og:image:height', $imageInfo->height, 'property');
$document->setMetaData('og:image:type', $imageInfo->mime, 'property');
}

if (!$document->getMetaData('twitter:image'))
Expand Down Expand Up @@ -471,10 +474,13 @@ public function onContentPrepare($context, &$article, &$params, $page)
{
$document->setMetaData('og:image', $imageURL, 'property');

$imageInfo = Image::getImageFileProperties($imageURL);
$document->setMetaData('og:image:width', $imageInfo['width'], 'property');
$document->setMetaData('og:image:height', $imageInfo['height'], 'property');
$document->setMetaData('og:image:type', $imageInfo['mime'], 'property');
// The Image libary can not handle remote images.
$imageForInfo = str_replace(Uri::root(), '', $imageURL);
$imageInfo = Image::getImageFileProperties($imageForInfo);

$document->setMetaData('og:image:width', $imageInfo->width, 'property');
$document->setMetaData('og:image:height', $imageInfo->height, 'property');
$document->setMetaData('og:image:type', $imageInfo->mime, 'property');
}

if (!$document->getMetaData('twitter:image'))
Expand Down

2 comments on commit 9be7282

@wilsonge
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Sorry :)

@zero-24
Copy link
Member Author

@zero-24 zero-24 commented on 9be7282 Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP i should have tested it on the live site ;)

Please sign in to comment.