OStatus: Picture posts are reformatted

This commit is contained in:
Michael Vogel 2015-12-04 05:57:33 +01:00
parent 4798675e6e
commit bb45112544
3 changed files with 18 additions and 4 deletions

View file

@ -1089,6 +1089,17 @@ 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") AND isset($siteinfo["url"]) AND isset($siteinfo["preview"])) {
$siteinfo["preview"] = str_replace(array("-1.jpg", "-1.png"), array("-2.jpg", "-2.png"), $siteinfo["preview"]);
$body = trim($siteinfo["text"])." [url]".$siteinfo["url"]."[/url]\n[img]".$siteinfo["preview"]."[/img]";
}
return $body;
}
function ostatus_add_header($doc, $owner) {
$a = get_app();
@ -1332,6 +1343,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;