$picturedata = Images::getInfoFromURLCached($matches[1]);
- if ($picturedata) {
+ if (!empty($picturedata)) {
if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1])) {
$post['image'] = $matches[1];
} else {
$post['text'] = trim(str_replace($pictures[0][0], '', $body));
} else {
$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['image'] = $pictures[0][1];
$post['preview'] = $pictures[0][2];
case 'photo':
if (!empty($siteinfo['image'])) {
$imgdata = Images::getInfoFromURLCached($siteinfo['image']);
- if ($imgdata) {
+ if (!empty($imgdata)) {
$attributes = [
'rel' => 'enclosure',
'href' => $siteinfo['image'],
}
}
break;
+
case 'video':
$attributes = [
'rel' => 'enclosure',
];
XML::addElement($doc, $root, 'link', '', $attributes);
break;
+
default:
+ Logger::warning('Unsupported type', ['type' => $siteinfo['type'], 'url' => $siteinfo['url']]);
break;
}
if (!DI::config()->get('system', 'ostatus_not_attach_preview') && ($siteinfo['type'] != 'photo') && isset($siteinfo['image'])) {
$imgdata = Images::getInfoFromURLCached($siteinfo['image']);
- if ($imgdata) {
+ if (!empty($imgdata)) {
$attributes = [
'rel' => 'enclosure',
'href' => $siteinfo['image'],