From 35ae690eabd1236fdf31b4f548f88ff13855ba73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Loguercio?= Date: Wed, 20 Jul 2016 16:03:16 -0500 Subject: [PATCH] Fix issue preventing user image upload when initial image is empty - v2 --- main/inc/lib/formvalidator/FormValidator.class.php | 1 + main/inc/lib/usermanager.lib.php | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index ccff092659..a6857faa3f 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -805,6 +805,7 @@ EOT; * @param string $name * @param string $label * @param array $attributes + * @throws Exception if the file doesn't have an id */ public function addFile($name, $label, $attributes = array()) { diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index c20b3c50d0..57f76ab209 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -1694,19 +1694,19 @@ class UserManager $image->crop($cropParameters); // Storing the new photos in 4 versions with various sizes. - + $userPath = self::getUserPathById($user_id, 'system'); $small = new Image($source_file); $small->resize(32); - $small->send_image($path.'small_'.$filename); + $small->send_image($userPath.'small_'.$filename); $medium = new Image($source_file); $medium->resize(85); - $medium->send_image($path.'medium_'.$filename); + $medium->send_image($userPath.'medium_'.$filename); $normal = new Image($source_file); $normal->resize(200); - $normal->send_image($path.$filename); + $normal->send_image($userPath.$filename); $big = new Image($source_file); // This is the original picture. - $big->send_image($path.'big_'.$filename); + $big->send_image($userPath.'big_'.$filename); $result = $small && $medium && $normal && $big;