Returning the correct data in oembed with photos

This commit is contained in:
Michael 2021-04-16 05:33:52 +00:00
parent 2ed98bd040
commit 676f62c012

View file

@ -33,6 +33,7 @@ use Friendica\Database\Database;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Images;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
use Friendica\Util\Proxy as ProxyUtils;
@ -162,7 +163,13 @@ class OEmbed
$oembed->type = $data['type'];
if ($oembed->type == 'photo') {
$oembed->url = $data['url'];
if (!empty($data['images'])) {
$oembed->url = $data['images'][0]['src'];
$oembed->width = $data['images'][0]['width'];
$oembed->height = $data['images'][0]['height'];
} else {
$oembed->type = 'link';
}
}
}
@ -190,7 +197,7 @@ class OEmbed
$oembed->author_url = $data['author_url'];
}
if (!empty($data['images'])) {
if (!empty($data['images']) && ($oembed->type != 'photo')) {
$oembed->thumbnail_url = $data['images'][0]['src'];
$oembed->thumbnail_width = $data['images'][0]['width'];
$oembed->thumbnail_height = $data['images'][0]['height'];