Images::getInfoFromURL[Cached]() will both return empty arrays on error and
that needs to be reflected here, too.
This commit is contained in:
parent
eb231bc548
commit
b996712ef7
2 changed files with 7 additions and 4 deletions
|
@ -111,7 +111,7 @@ class BBCode
|
||||||
|
|
||||||
$picturedata = Images::getInfoFromURLCached($matches[1]);
|
$picturedata = Images::getInfoFromURLCached($matches[1]);
|
||||||
|
|
||||||
if ($picturedata) {
|
if (!empty($picturedata)) {
|
||||||
if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1])) {
|
if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1])) {
|
||||||
$post['image'] = $matches[1];
|
$post['image'] = $matches[1];
|
||||||
} else {
|
} else {
|
||||||
|
@ -320,7 +320,7 @@ class BBCode
|
||||||
$post['text'] = trim(str_replace($pictures[0][0], '', $body));
|
$post['text'] = trim(str_replace($pictures[0][0], '', $body));
|
||||||
} else {
|
} else {
|
||||||
$imgdata = Images::getInfoFromURLCached($pictures[0][1]);
|
$imgdata = Images::getInfoFromURLCached($pictures[0][1]);
|
||||||
if ($imgdata && substr($imgdata['mime'], 0, 6) == 'image/') {
|
if (!empty($imgdata) && substr($imgdata['mime'], 0, 6) == 'image/') {
|
||||||
$post['type'] = 'photo';
|
$post['type'] = 'photo';
|
||||||
$post['image'] = $pictures[0][1];
|
$post['image'] = $pictures[0][1];
|
||||||
$post['preview'] = $pictures[0][2];
|
$post['preview'] = $pictures[0][2];
|
||||||
|
|
|
@ -1377,7 +1377,7 @@ class OStatus
|
||||||
case 'photo':
|
case 'photo':
|
||||||
if (!empty($siteinfo['image'])) {
|
if (!empty($siteinfo['image'])) {
|
||||||
$imgdata = Images::getInfoFromURLCached($siteinfo['image']);
|
$imgdata = Images::getInfoFromURLCached($siteinfo['image']);
|
||||||
if ($imgdata) {
|
if (!empty($imgdata)) {
|
||||||
$attributes = [
|
$attributes = [
|
||||||
'rel' => 'enclosure',
|
'rel' => 'enclosure',
|
||||||
'href' => $siteinfo['image'],
|
'href' => $siteinfo['image'],
|
||||||
|
@ -1388,6 +1388,7 @@ class OStatus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'video':
|
case 'video':
|
||||||
$attributes = [
|
$attributes = [
|
||||||
'rel' => 'enclosure',
|
'rel' => 'enclosure',
|
||||||
|
@ -1398,13 +1399,15 @@ class OStatus
|
||||||
];
|
];
|
||||||
XML::addElement($doc, $root, 'link', '', $attributes);
|
XML::addElement($doc, $root, 'link', '', $attributes);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Logger::warning('Unsupported type', ['type' => $siteinfo['type'], 'url' => $siteinfo['url']]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DI::config()->get('system', 'ostatus_not_attach_preview') && ($siteinfo['type'] != 'photo') && isset($siteinfo['image'])) {
|
if (!DI::config()->get('system', 'ostatus_not_attach_preview') && ($siteinfo['type'] != 'photo') && isset($siteinfo['image'])) {
|
||||||
$imgdata = Images::getInfoFromURLCached($siteinfo['image']);
|
$imgdata = Images::getInfoFromURLCached($siteinfo['image']);
|
||||||
if ($imgdata) {
|
if (!empty($imgdata)) {
|
||||||
$attributes = [
|
$attributes = [
|
||||||
'rel' => 'enclosure',
|
'rel' => 'enclosure',
|
||||||
'href' => $siteinfo['image'],
|
'href' => $siteinfo['image'],
|
||||||
|
|
Loading…
Reference in a new issue