]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fixed remote subscribe avatar problems
authorEvan Prodromou <evan@controlyourself.ca>
Mon, 9 Feb 2009 23:13:11 +0000 (23:13 +0000)
committerEvan Prodromou <evan@controlyourself.ca>
Mon, 9 Feb 2009 23:18:28 +0000 (18:18 -0500)
Had some Avatar file-copying issues; seem to be fixed.

actions/finishremotesubscribe.php
actions/userauthorization.php

index f9094a50cafa91fd2b240d3df930229d9f7471e8..76db887deb4dca85f0347e5c46a18a4ee5021e82 100644 (file)
@@ -237,7 +237,13 @@ class FinishremotesubscribeAction extends Action
     {
         $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
         copy($url, $temp_filename);
-        return $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));
+        return $profile->setOriginal($filename);
     }
 
     function access_token($omb)
index 7455a41a6f1e26c08c02a4e315fdff56dd75e8de..ed17ceec977723ecd20899d380a645f183eeea20 100644 (file)
@@ -330,7 +330,13 @@ class UserauthorizationAction extends Action
     {
         $temp_filename = tempnam(sys_get_temp_dir(), 'listenee_avatar');
         copy($url, $temp_filename);
-        return $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));
+        return $profile->setOriginal($filename);
     }
 
     function showAcceptMessage($tok)