From 911fd6c654435e60167007fd95a4e8ace50806e8 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 25 Oct 2015 18:01:44 +0100 Subject: improve photo item object - we now provide the infos for all available photo sizes --- include/text.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 11062a1b2..c30be77b8 100644 --- a/include/text.php +++ b/include/text.php @@ -1374,12 +1374,23 @@ function prepare_body(&$item,$attach = false) { $s = prepare_text($item['body'],$item['mimetype'], false); // } - $is_photo = (($item['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false); + $photo = ''; + $is_photo = (($item['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false); if($is_photo) { $object = json_decode($item['object'],true); - $photo = ''; + + // if original photo width is <= 640px prepend it to item body + if($object['link'][0]['width'] && $object['link'][0]['width'] <= 640) { + $s = '
' . $s; + } + + // if original photo width is > 640px make it a cover photo + if($object['link'][0]['width'] && $object['link'][0]['width'] > 640) { + $scale = ((($object['link'][1]['width'] == 1024) || ($object['link'][1]['height'] == 1024)) ? 1 : 0); + $photo = ''; + } } $prep_arr = array( -- cgit v1.2.3