diff options
author | zotlabs <mike@macgirvin.com> | 2017-10-04 19:37:35 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-10-04 19:37:35 -0700 |
commit | 2862baeee1cbecead3c9d38d2798140ac0256d1a (patch) | |
tree | 525c291cd4611b0cbb481bb928d1c653cfa6a700 /include | |
parent | 47b29594867deb96f6b93d8a5ace8d4d4e569630 (diff) | |
parent | 6f88d5e92be06ad8fa61f900e8a4fb41ba54135e (diff) | |
download | volse-hubzilla-2862baeee1cbecead3c9d38d2798140ac0256d1a.tar.gz volse-hubzilla-2862baeee1cbecead3c9d38d2798140ac0256d1a.tar.bz2 volse-hubzilla-2862baeee1cbecead3c9d38d2798140ac0256d1a.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'include')
-rw-r--r-- | include/contact_widgets.php | 8 | ||||
-rw-r--r-- | include/nav.php | 2 | ||||
-rw-r--r-- | include/photos.php | 79 |
3 files changed, 83 insertions, 6 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php index e5bb696f8..a13f87573 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -143,7 +143,7 @@ function cardcategories_widget($baseurl,$selected = '') { -function common_friends_visitor_widget($profile_uid,$cnt = 10) { +function common_friends_visitor_widget($profile_uid,$cnt = 25) { if(local_channel() == $profile_uid) return; @@ -161,14 +161,14 @@ function common_friends_visitor_widget($profile_uid,$cnt = 10) { return; $r = common_friends($profile_uid,$observer_hash,0,$cnt,true); - + return replace_macros(get_markup_template('remote_friends_common.tpl'), array( - '$desc' => sprintf( t('Common connections: %d'), $t), + '$desc' => t('Common Connections'), '$base' => z_root(), '$uid' => $profile_uid, '$cid' => $observer, '$linkmore' => (($t > $cnt) ? 'true' : ''), - '$more' => t('show more'), + '$more' => sprintf( t('View all %d common connections'), $t), '$items' => $r )); diff --git a/include/nav.php b/include/nav.php index 01decb2bf..eccb89764 100644 --- a/include/nav.php +++ b/include/nav.php @@ -180,6 +180,8 @@ EOT; $nav['intros'] = array('connections/ifpending', t('Connections'), "", t('Connections'),'connections_nav_btn'); + if(is_site_admin()) + $nav['registrations'] = array('admin/accounts', t('Registrations'), "", t('Registrations'),'registrations_nav_btn'); $nav['notifications'] = array('notifications/system', t('Notices'), "", t('Notifications'),'notifications_nav_btn'); diff --git a/include/photos.php b/include/photos.php index c7c8fc0a4..5de68f162 100644 --- a/include/photos.php +++ b/include/photos.php @@ -66,7 +66,19 @@ function photo_upload($channel, $observer, $args) { $os_storage = 0; if($args['os_syspath'] && $args['getimagesize']) { - $imagedata = @file_get_contents($args['os_syspath']); + if($args['getimagesize'][0] > 1600 || $args['getimagesize'][1] > 1600) { + $imagick_path = get_config('system','imagick_convert_path'); + if($imagick_path && @file_exists($imagick_path)) { + $tmp_name = $args['os_syspath'] . '-001'; + $newsize = photo_calculate_1600_scale($args['getimagesize']); + exec($imagick_path . ' ' . $args['os_syspath'] . ' -resize ' . $newsize . '^ ' . $tmp_name); + $imagedata = @file_get_contents($tmp_name); + @unlink($tmp_name); + } + } + else { + $imagedata = @file_get_contents($args['os_syspath']); + } $filename = $args['filename']; $filesize = strlen($imagedata); // this is going to be deleted if it exists @@ -122,7 +134,6 @@ function photo_upload($channel, $observer, $args) { } logger('photo_upload: loading the contents of ' . $src , LOGGER_DEBUG); - $imagedata = @file_get_contents($src); } @@ -428,6 +439,70 @@ function photo_upload($channel, $observer, $args) { return $ret; } + +function photo_calculate_1600_scale($arr) { + + $max = 1600; + $width = $arr[0]; + $height = $arr[1]; + + $dest_width = $dest_height = 0; + + if((! $width)|| (! $height)) + return FALSE; + + if($width > $max && $height > $max) { + + // very tall image (greater than 16:9) + // constrain the width - let the height float. + + if((($height * 9) / 16) > $width) { + $dest_width = $max; + $dest_height = intval(( $height * $max ) / $width); + } + + // else constrain both dimensions + + elseif($width > $height) { + $dest_width = $max; + $dest_height = intval(( $height * $max ) / $width); + } + else { + $dest_width = intval(( $width * $max ) / $height); + $dest_height = $max; + } + } + else { + if( $width > $max ) { + $dest_width = $max; + $dest_height = intval(( $height * $max ) / $width); + } + else { + if( $height > $max ) { + // very tall image (greater than 16:9) + // but width is OK - don't do anything + + if((($height * 9) / 16) > $width) { + $dest_width = $width; + $dest_height = $height; + } + else { + $dest_width = intval(( $width * $max ) / $height); + $dest_height = $max; + } + } + else { + $dest_width = $width; + $dest_height = $height; + } + } + } + + return $dest_width . 'x' . $dest_height; + +} + + /** * @brief Returns a list with all photo albums observer is allowed to see. * |