Returning the correct data in oembed with photos
This commit is contained in:
parent
2ed98bd040
commit
676f62c012
|
@ -33,6 +33,7 @@ use Friendica\Database\Database;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
use Friendica\Util\Images;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\ParseUrl;
|
use Friendica\Util\ParseUrl;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy as ProxyUtils;
|
||||||
|
@ -162,7 +163,13 @@ class OEmbed
|
||||||
$oembed->type = $data['type'];
|
$oembed->type = $data['type'];
|
||||||
|
|
||||||
if ($oembed->type == 'photo') {
|
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'];
|
$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_url = $data['images'][0]['src'];
|
||||||
$oembed->thumbnail_width = $data['images'][0]['width'];
|
$oembed->thumbnail_width = $data['images'][0]['width'];
|
||||||
$oembed->thumbnail_height = $data['images'][0]['height'];
|
$oembed->thumbnail_height = $data['images'][0]['height'];
|
||||||
|
|
Loading…
Reference in a new issue