X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fostatus.php;fp=include%2Fostatus.php;h=932fc1fa9a7ea142fe06518c14e50fab657e16e9;hb=25c2e219eed41f95637c13e24b263a0870fb85be;hp=07eaec85d50f4b962a3b281507e84606ade94ce9;hpb=7ac7caef08a414d056aa6cbbf4ace5fd6990039a;p=friendica.git diff --git a/include/ostatus.php b/include/ostatus.php index 07eaec85d5..932fc1fa9a 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -9,6 +9,7 @@ require_once("include/socgraph.php"); require_once("include/Photo.php"); require_once("include/Scrape.php"); require_once("include/follow.php"); +require_once("mod/proxy.php"); define('OSTATUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes define('OSTATUS_DEFAULT_POLL_TIMEFRAME', 1440); // given in minutes @@ -1089,6 +1090,33 @@ function xml_add_element($doc, $parent, $element, $value = "", $attributes = arr $parent->appendChild($element); } +function ostatus_format_picture_post($body) { + $siteinfo = get_attached_data($body); + + if (($siteinfo["type"] == "photo")) { + if (isset($siteinfo["preview"])) + $preview = $siteinfo["preview"]; + else + $preview = $siteinfo["image"]; + + // Is it a remote picture? Then make a smaller preview here + $preview = proxy_url($preview, false, PROXY_SIZE_SMALL); + + // Is it a local picture? Then make it smaller here + $preview = str_replace(array("-0.jpg", "-0.png"), array("-2.jpg", "-2.png"), $preview); + $preview = str_replace(array("-1.jpg", "-1.png"), array("-2.jpg", "-2.png"), $preview); + + if (isset($siteinfo["url"])) + $url = $siteinfo["url"]; + else + $url = $siteinfo["image"]; + + $body = trim($siteinfo["text"])." [url]".$url."[/url]\n[img]".$preview."[/img]"; + } + + return $body; +} + function ostatus_add_header($doc, $owner) { $a = get_app(); @@ -1340,6 +1368,8 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false) { else $body = $item['body']; + $body = ostatus_format_picture_post($body); + if ($item['title'] != "") $body = "[b]".$item['title']."[/b]\n\n".$body;