mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +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:
parent
e683236793
commit
37df05c7a5
2 changed files with 21 additions and 2 deletions
|
@ -107,7 +107,16 @@ final class PhabricatorOAuthDefaultRegistrationController
|
||||||
'name' => $provider->getProviderKey().'-profile.jpg',
|
'name' => $provider->getProviderKey().'-profile.jpg',
|
||||||
'authorPHID' => $user->getPHID(),
|
'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 {
|
try {
|
||||||
|
|
|
@ -217,7 +217,17 @@ final class PhabricatorUserOAuthSettingsPanelController
|
||||||
'name' => $provider->getProviderKey().'-profile.jpg',
|
'name' => $provider->getProviderKey().'-profile.jpg',
|
||||||
'authorPHID' => $user->getPHID(),
|
'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();
|
$user->save();
|
||||||
} else {
|
} else {
|
||||||
$error = 'Unable to retrieve image.';
|
$error = 'Unable to retrieve image.';
|
||||||
|
|
Loading…
Reference in a new issue