]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Correctly handle avatars at updateProfile
authorAdrian Lang <mail@adrianlang.de>
Sat, 21 Feb 2009 21:41:24 +0000 (22:41 +0100)
committerEvan Prodromou <evan@controlyourself.ca>
Fri, 27 Feb 2009 23:39:42 +0000 (15:39 -0800)
actions/updateprofile.php

index 898c535432655860c06284695fb4e4c8c200a358..4751a04ff31726b9002caca41db06099f2cbc3fd 100644 (file)
@@ -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;
                 }