From b1e83f331ee3f986a7c86d29de9002f88ff76968 Mon Sep 17 00:00:00 2001 From: Fabrixxm Date: Thu, 23 Oct 2014 16:27:30 +0200 Subject: [PATCH] workaround for issue #1134 --- include/api.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/include/api.php b/include/api.php index 69095aec10..3d01c10cb8 100644 --- a/include/api.php +++ b/include/api.php @@ -1838,7 +1838,17 @@ return($entities); } - + function api_format_items_embeded_images($item, $text){ + $a = get_app(); + $text = preg_replace_callback( + "|data:image/([^;]+)[^=]+=*|m", + function($match) use ($a, $item) { + return $a->get_baseurl()."/display/".$item['guid']; + }, + $text); + return $text; + } + function api_format_items($r,$user_info, $filter_user = false) { $a = get_app(); @@ -1907,6 +1917,12 @@ if (($item["network"] == NETWORK_FEED) and (strlen($statustext)> 1000)) $statustext = substr($statustext, 0, 1000)."... \n".$item["plink"]; + $statushtml = trim(bbcode($item['body'], false, false)); + + // handle data: images + + $statustext = api_format_items_embeded_images($item,$statustext); + $status = array( 'text' => $statustext, 'truncated' => False, @@ -1924,7 +1940,7 @@ //'attachments' => array(), 'user' => $status_user , //'entities' => NULL, - 'statusnet_html' => trim(bbcode($item['body'], false, false)), + 'statusnet_html' => $statushtml, 'statusnet_conversation_id' => $item['parent'], ); @@ -2412,9 +2428,6 @@ - - - function api_share_as_retweet($a, $uid, &$item) { $body = trim($item["body"]);