Fixed Improve the user image resize algorythm - Fixes CT#1414

This also add some minor changes about css on images.
skala
Marco Antonio Villegas Vega 15 years ago
parent 0be8da5c6d
commit 5370cf9916
  1. 4
      main/inc/lib/social.lib.php
  2. 2
      main/inc/lib/sortabletable.class.php
  3. 23
      main/inc/lib/usermanager.lib.php

@ -815,11 +815,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') {

@ -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;}

@ -2270,15 +2270,20 @@ class UserManager
}
$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);
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;
}

Loading…
Cancel
Save