]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/FacebookBridge/actions/facebookfinishlogin.php
Merge branch 'master' of git.gnu.io:Quix0r/gnu-social
[quix0rs-gnu-social.git] / plugins / FacebookBridge / actions / facebookfinishlogin.php
index da0dbc2b72081a5f14d8aba73e422edd117606f8..e0cae928f4ffb8c8c73948bac167e7a6a409e49b 100644 (file)
@@ -436,8 +436,14 @@ class FacebookfinishloginAction extends Action
                 } else {
                     // save it as an avatar
 
-                    $file = new ImageFile($user->id, Avatar::path($tmpname));
-                    $filename = $file->resize(180); // size of the biggest img we get from Facebook
+                    $imagefile = new ImageFile(null, Avatar::path($tmpname));
+                    $filename = Avatar::filename($user->id, image_type_to_extension($imagefile->preferredType()),
+                                                 180, common_timestamp());
+                    // Previous docs said 180 is the "biggest img we get from Facebook"
+                    $imagefile->resizeTo(Avatar::path($filename, array('width'=>180, 'height'=>180)));
+
+                    // No need to keep the temporary file around...
+                    @unlink(Avatar::path($tmpname));
 
                     $profile   = $user->getProfile();
 
@@ -457,7 +463,6 @@ class FacebookfinishloginAction extends Action
                         );
 
                         // clean up tmp file
-                        @unlink(Avatar::path($tmpname));
                     }
 
                 }