if (count($pictures) == 1) {
// Checking, if the link goes to a picture
$data = parseurl_getsiteinfo($pictures[0][1], true);
-
if ($data["type"] == "photo") {
$post["type"] = "photo";
if (isset($data["images"][0]))
$post["preview"] = $pictures[0][2];
$post["text"] = str_replace($pictures[0][0], "", $body);
} else {
- $img_str = fetch_url($pictures[0][1]);
- $imgdata = get_photo_info($img_str);
+ $imgdata = get_photo_info($pictures[0][1]);
if (substr($imgdata["mime"], 0, 6) == "image/") {
$post["type"] = "photo";
$post["image"] = $pictures[0][1];
$post["type"] = "text";
$post["text"] = trim($body);
}
+ } elseif (isset($post["url"]) AND ($post["type"] == "video")) {
+ require_once("mod/parse_url.php");
+ $data = parseurl_getsiteinfo($post["url"], true);
+
+ if (isset($data["images"][0]))
+ $post["image"] = $data["images"][0]["src"];
}
return($post);
$msg = str_replace(" ", " ", $msg);
// Twitter is using its own limiter, so we always assume that shortened links will have this length
- if (strlen($link) > 0)
+ if (iconv_strlen($link, "UTF-8") > 0)
$limit = $limit - 23;
- if (strlen($msg) > $limit) {
+ if (iconv_strlen($msg, "UTF-8") > $limit) {
if (!isset($post["url"])) {
$limit = $limit - 23;
$post["url"] = $b["plink"];
- }
+ } elseif (strpos($b["body"], "[share") !== false)
+ $post["url"] = $b["plink"];
$msg = shortenmsg($msg, $limit);
}