resizeAvatarImage() public static méthode

Only works with gif, jpg and png file types. If you want to change this also have a look into method validateImageFile() inside this model. TROUBLESHOOTING: You don't see the new image ? Press F5 or CTRL-F5 to refresh browser cache.
public static resizeAvatarImage ( string $source_image, string $destination, integer $final_width = 44, integer $final_height = 44 ) : boolean
$source_image string The location to the original raw image
$destination string The location to save the new image
$final_width integer The desired width of the new image
$final_height integer The desired height of the new image
Résultat boolean success state
Exemple #1
0
 /**
  * Create an avatar picture (and checks all necessary things too)
  * TODO decouple
  * TODO total rebuild
  */
 public static function createAvatar()
 {
     // check avatar folder writing rights, check if upload fits all rules
     if (AvatarModel::isAvatarFolderWritable() and AvatarModel::validateImageFile()) {
         // create a jpg file in the avatar folder, write marker to database
         $target_file_path = Config::get('PATH_AVATARS') . Session::get('user_id');
         AvatarModel::resizeAvatarImage($_FILES['avatar_file']['tmp_name'], $target_file_path, Config::get('AVATAR_SIZE'), Config::get('AVATAR_SIZE'), Config::get('AVATAR_JPEG_QUALITY'));
         AvatarModel::writeAvatarToDatabase(Session::get('user_id'));
         Session::set('user_avatar_file', AvatarModel::getPublicUserAvatarFilePathByUserId(Session::get('user_id')));
         Session::add('feedback_positive', Text::get('FEEDBACK_AVATAR_UPLOAD_SUCCESSFUL'));
     }
 }