1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

T1354 : Resize profile pics (specifically to handle github v3 api)

Reviewed by: epriestley
GitHub Pull: https://github.com/facebook/phabricator/pull/140
This commit is contained in:
Daniel Fullarton 2012-06-25 21:25:50 +10:00 committed by epriestley
parent e683236793
commit 37df05c7a5
2 changed files with 21 additions and 2 deletions

View file

@ -107,7 +107,16 @@ final class PhabricatorOAuthDefaultRegistrationController
'name' => $provider->getProviderKey().'-profile.jpg',
'authorPHID' => $user->getPHID(),
));
$user->setProfileImagePHID($file->getPHID());
$xformer = new PhabricatorImageTransformer();
// Resize OAuth image to a reasonable size
$small_xformed = $xformer->executeProfileTransform(
$file,
$width = 50,
$min_height = 50,
$max_height = 50);
$user->setProfileImagePHID($small_xformed->getPHID());
}
try {

View file

@ -217,7 +217,17 @@ final class PhabricatorUserOAuthSettingsPanelController
'name' => $provider->getProviderKey().'-profile.jpg',
'authorPHID' => $user->getPHID(),
));
$user->setProfileImagePHID($file->getPHID());
$xformer = new PhabricatorImageTransformer();
// Resize OAuth image to a reasonable size
$small_xformed = $xformer->executeProfileTransform(
$file,
$width = 50,
$min_height = 50,
$max_height = 50);
$user->setProfileImagePHID($small_xformed->getPHID());
$user->save();
} else {
$error = 'Unable to retrieve image.';