diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-10-25 18:01:44 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-10-25 18:01:44 +0100 |
commit | 911fd6c654435e60167007fd95a4e8ace50806e8 (patch) | |
tree | c048730dc4668c75d35a9c8a6a6427812b078cc2 /include/text.php | |
parent | 123fe58c26ed29a6c75357a1ced004c1d4263d04 (diff) | |
download | volse-hubzilla-911fd6c654435e60167007fd95a4e8ace50806e8.tar.gz volse-hubzilla-911fd6c654435e60167007fd95a4e8ace50806e8.tar.bz2 volse-hubzilla-911fd6c654435e60167007fd95a4e8ace50806e8.zip |
improve photo item object - we now provide the infos for all available photo sizes
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 15 |
1 files changed, 13 insertions, 2 deletions
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 = '<a href="' . zid(rawurldecode(get_rel_link($object['link'],'alternate'))) . '" target="_newwin"><img style="max-width:' . $object['width'] . 'px; width:100%; height:auto;" src="'. zid(rawurldecode($object['id'])) . '"></a>'; + + // if original photo width is <= 640px prepend it to item body + if($object['link'][0]['width'] && $object['link'][0]['width'] <= 640) { + $s = '<div class="inline-photo-item-wrapper"><a href="' . zid(rawurldecode($object['id'])) . '" target="_newwin"><img class="inline-photo-item" style="max-width:' . $object['link'][0]['width'] . 'px; width:100%; height:auto;" src="' . zid(rawurldecode($object['link'][0]['href'])) . '"></a></div>' . $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 = '<a href="' . zid(rawurldecode($object['id'])) . '" target="_newwin"><img style="max-width:' . $object['link'][$scale]['width'] . 'px; width:100%; height:auto;" src="' . zid(rawurldecode($object['link'][$scale]['href'])) . '"></a>'; + } } $prep_arr = array( |