]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/updateprofile.php
you can _so_ leave a group if you're its admin
[quix0rs-gnu-social.git] / 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;
                 }