Returning the correct data in oembed with photos

pull/10148/head
Michael 2021-04-16 05:33:52 +00:00
rodzic 2ed98bd040
commit 676f62c012
1 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -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'];