Yannick Warnier 14 years ago
parent
commit
f56ceb6464
3 changed files with 32 additions and 27 deletions
  1. 2 2
      main/inc/lib/social.lib.php
  2. 1 1
      main/inc/lib/sortabletable.class.php
  3. 29 24
      main/inc/lib/usermanager.lib.php

+ 2 - 2
main/inc/lib/social.lib.php

@@ -781,11 +781,11 @@ class SocialManager extends UserManager {
 				}
 				$image_array = UserManager::get_user_picture_path_by_id($uid, 'system', false, true);
 
-				$friends_profile = SocialManager::get_picture_user($uid, $image_array['file'], 80, USER_IMAGE_SIZE_ORIGINAL );
+				$friends_profile = UserManager::get_picture_user($uid, $image_array['file'], 80, USER_IMAGE_SIZE_MEDIUM );
 				// reduce image
 				$name = api_get_person_name($user_info['firstName'], $user_info['lastName']);
 
-				$table_row[] = '<a href="'.$url.'"><img title = "'.$name.'" class="social-home-users-online" alt="'.$name.'" src="'.$friends_profile['file'].'" height="60px"></a>';
+				$table_row[] = '<a href="'.$url.'"><img title = "'.$name.'" class="social-home-users-online" alt="'.$name.'" src="'.$friends_profile['file'].'"></a>';
 				$table_row[] = '<a href="'.$url.'" style="font-size:10px;">'.api_get_person_name(cut($user_info['firstName'],15), cut($user_info['lastName'],15)).'</a>';
 /*
 				if (api_get_setting('show_email_addresses') == 'true') {

+ 1 - 1
main/inc/lib/sortabletable.class.php

@@ -303,7 +303,7 @@ class SortableTable extends HTML_Table {
 					.sub-header { width:100%; padding-top: 10px; padding-right: 10px; padding-left: 10px; height:30px;}
 					.grid_container { width:100%;}
 					.grid_item { height: 120px; width:98px;  border:1px dotted #ccc; float:left; padding:5px; margin:8px;}
-					.grid_element_0 { width:100px; float:left; text-align:center; margin-bottom:5px;}
+					.grid_element_0 { width:100px; height: 100px; float:left; text-align:center; margin-bottom:5px;}
 					.grid_element_1 { width:100px; float:left; text-align:center;margin-bottom:5px;}
 					.grid_element_2 { width:150px; float:left;}
 

+ 29 - 24
main/inc/lib/usermanager.lib.php

@@ -2258,30 +2258,35 @@ class UserManager
     }
 
     /**
-	 * Resize a picture
-	 *
-	 * @param  string file picture
-	 * @param  int size in pixels
-	 * @return obj image object
-	 */
-	public static function resize_picture($file, $max_size_for_picture) {
-		if (!class_exists('image')) {
-			require_once api_get_path(LIBRARY_PATH).'image.lib.php';
-		}
-	 	$temp = new image($file);
-	 	$picture_infos = api_getimagesize($file);
-		if ($picture_infos[0] > $max_size_for_picture) {
-			$thumbwidth = $max_size_for_picture;
-			if (empty($thumbwidth) or $thumbwidth == 0) {
-				$thumbwidth = $max_size_for_picture;
-			}
-			$new_height = round(($thumbwidth / $picture_infos[0]) * $picture_infos[1]);
-			if ($new_height > $max_size_for_picture)
-			$new_height = $thumbwidth;
-			$temp->resize($thumbwidth, $new_height, 0);
-		}
-		return $temp;
-	}
+     * Resize a picture
+     *
+     * @param  string file picture
+     * @param  int size in pixels
+     * @return obj image object
+     */
+    public static function resize_picture($file, $max_size_for_picture) {
+      if (!class_exists('image')) {
+        require_once api_get_path(LIBRARY_PATH).'image.lib.php';
+      }
+      $temp = new image($file);
+      $picture_infos = api_getimagesize($file);
+      list($width, $height) = api_getimagesize($file);
+      if ($width >= $height) {
+        if ($width >= $max_size_for_picture) {
+          // scale height
+          $new_height = round($height * ($max_size_for_picture / $width));
+          $temp->resize($max_size_for_picture, $new_height, 0);
+        }
+      }
+      else { // height > $width
+        if ($height >= $max_size_for_picture) {
+          // scale width
+          $new_width = round($width * ($max_size_for_picture / $height));
+          $temp->resize($new_width, $max_size_for_picture, 0);
+        }
+      }
+      return $temp;
+    }
 
     /**
      * Gets the current user image