From d4b6e7266ad80add5ff29c947cfad4bd5dbd3c8a Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Sat, 21 Feb 2009 22:41:24 +0100 Subject: [PATCH] Correctly handle avatars at updateProfile --- actions/updateprofile.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/actions/updateprofile.php b/actions/updateprofile.php index 898c535432..4751a04ff3 100644 --- a/actions/updateprofile.php +++ b/actions/updateprofile.php @@ -162,7 +162,13 @@ class UpdateprofileAction extends Action if ($avatar) { $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar'); copy($avatar, $temp_filename); - if (!$profile->setOriginal($temp_filename)) { + $imagefile = new ImageFile($profile->id, $temp_filename); + $filename = Avatar::filename($profile->id, + image_type_to_extension($imagefile->type), + null, + common_timestamp()); + rename($temp_filename, Avatar::path($filename)); + if (!$profile->setOriginal($filename)) { $this->serverError(_('Could not save avatar info'), 500); return false; } -- 2.39.5