]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Do a better job of saving the original avatar from Facebook
authorZach Copley <zach@status.net>
Tue, 27 Sep 2011 04:31:41 +0000 (04:31 +0000)
committerZach Copley <zach@status.net>
Tue, 27 Sep 2011 04:31:41 +0000 (04:31 +0000)
plugins/FacebookBridge/actions/facebookfinishlogin.php

index 260761e862d07f3e24686766160683dff58af5ff..4c8c9f860f2394104e4815032015c4926ceddbfa 100644 (file)
@@ -458,9 +458,13 @@ class FacebookfinishloginAction extends Action
                     common_log(LOG_WARNING, 'Couldn\'t save tmp Facebook avatar: ' . $tmpname, __FILE__);
                 } 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
+
                     $profile   = $user->getProfile();
 
-                    if ($profile->setOriginal($tmpname)) {
+                    if ($profile->setOriginal($filename)) {
                         common_log(
                             LOG_INFO,
                             sprintf(
@@ -475,7 +479,7 @@ class FacebookfinishloginAction extends Action
                              __FILE__
                         );
 
-                        // clean up
+                        // clean up tmp file
                         @unlink(Avatar::path($tmpname));
                     }