diff options
author | Adrian Lang <mail@adrianlang.de> | 2009-02-21 22:41:24 +0100 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-02-27 15:39:42 -0800 |
commit | d4b6e7266ad80add5ff29c947cfad4bd5dbd3c8a (patch) | |
tree | b6cc1dcaed6e601cb27994cf5716f1eb820512e3 | |
parent | 616fd16bc528ce78d7fc1fa8a6ad5a67f10ae5eb (diff) |
Correctly handle avatars at updateProfile
-rw-r--r-- | actions/updateprofile.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/actions/updateprofile.php b/actions/updateprofile.php index 898c53543..4751a04ff 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; } |