Page MenuHomePhabricator

Actual 2x avatar, new profile picture options
ClosedPublic

Authored by chad on Dec 4 2015, 5:28 PM.

Details

Summary

Provides a real 2x avatar and offers new built in images for profile pictures.

Test Plan

reload profile, see sharper image, pick eevee, see eevee

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

chad updated this revision to Diff 35474.Dec 4 2015, 5:28 PM
chad retitled this revision from to Actual 2x avatar.
chad updated this object.
chad edited the test plan for this revision. (Show Details)
chad added a reviewer: epriestley.
chad added a comment.Dec 4 2015, 5:38 PM

Basically, I'd like to maybe do one or two things:

  1. Give a different default image for whatever your UID ends in, 0-9.
  2. Give a selection of images to choose from in Edit Picture.
epriestley edited edge metadata.Dec 4 2015, 6:11 PM

For defaults, something like:

  • Change PhabricatorUser::getDefaultProfileImageURI() to be $user->getDefaultProfileImageURI(), since it now depends on which user we're asking about.
  • Change callsites call it as $user->... (hopefully no weird/hard ones).
  • For users with an ID, use $user->getID() % 10 or similar to select an image. For users without an ID (logged out users, omnipotent user) choose the default or some special image.
  • Existing images will be cached. You can add a 2 or something to the array in PhabricatorUser->getProfileImageVersion() to break the cache.

For choosing, something like:

  • In PhabricatorPeopleProfilePictureController, change this line:
$default_image = PhabricatorFile::loadBuiltin($viewer, 'profile.png');

...to pick an image based on $viewer instead (profile2.png, or whatever). This will give you a consistent default image (but not a choice between multiple images).

  • If you want to add more default options, use PhabricatorFile::loadBuiltin() to load builtin files and then just dump them into $images:
$builtins = array('x.png', 'y.png');
foreach ($builtins as $builtin) {
  $file = PhabricatorFile::loadBuiltin($builtin);
  $images[$file->getPHID()] = array(
    'uri' => $file->getBestURI(),
    'tip' => pht('Builtin Image'),
  );
}

That should make them show up, I think.

chad updated this revision to Diff 35477.Dec 4 2015, 8:45 PM
chad edited edge metadata.
  • update to allow users to pick
chad retitled this revision from Actual 2x avatar to Actual 2x avatar, new profile picture options.Dec 4 2015, 8:49 PM
chad updated this object.
chad edited the test plan for this revision. (Show Details)
epriestley accepted this revision.Dec 4 2015, 9:21 PM
epriestley edited edge metadata.
This revision is now accepted and ready to land.Dec 4 2015, 9:21 PM
This revision was automatically updated to reflect the committed changes.