$picturedata = Image::getInfoFromURL($matches[1]);
- if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1])) {
- $post["image"] = $matches[1];
- } else {
- $post["preview"] = $matches[1];
+ if ($picturedata) {
+ if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1])) {
+ $post["image"] = $matches[1];
+ } else {
+ $post["preview"] = $matches[1];
+ }
}
}
$post["text"] = str_replace($pictures[0][0], "", $body);
} else {
$imgdata = Image::getInfoFromURL($pictures[0][1]);
- if (substr($imgdata["mime"], 0, 6) == "image/") {
+ if ($imgdata && substr($imgdata["mime"], 0, 6) == "image/") {
$post["type"] = "photo";
$post["image"] = $pictures[0][1];
$post["preview"] = $pictures[0][2];
}
/**
- * @brief Adds attachement data to the XML document
+ * @brief Adds attachment data to the XML document
*
* @param object $doc XML document
* @param object $root XML root element where the hub links are added
switch ($siteinfo["type"]) {
case 'photo':
$imgdata = Image::getInfoFromURL($siteinfo["image"]);
- $attributes = ["rel" => "enclosure",
- "href" => $siteinfo["image"],
- "type" => $imgdata["mime"],
- "length" => intval($imgdata["size"])];
- XML::addElement($doc, $root, "link", "", $attributes);
+ if ($imgdata) {
+ $attributes = ["rel" => "enclosure",
+ "href" => $siteinfo["image"],
+ "type" => $imgdata["mime"],
+ "length" => intval($imgdata["size"])];
+ XML::addElement($doc, $root, "link", "", $attributes);
+ }
break;
case 'video':
$attributes = ["rel" => "enclosure",
if (!Config::get('system', 'ostatus_not_attach_preview') && ($siteinfo["type"] != "photo") && isset($siteinfo["image"])) {
$imgdata = Image::getInfoFromURL($siteinfo["image"]);
- $attributes = ["rel" => "enclosure",
- "href" => $siteinfo["image"],
- "type" => $imgdata["mime"],
- "length" => intval($imgdata["size"])];
+ if ($imgdata) {
+ $attributes = ["rel" => "enclosure",
+ "href" => $siteinfo["image"],
+ "type" => $imgdata["mime"],
+ "length" => intval($imgdata["size"])];
- XML::addElement($doc, $root, "link", "", $attributes);
+ XML::addElement($doc, $root, "link", "", $attributes);
+ }
}
$arr = explode('[/attach],', $item['attach']);