Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a 1:1 ratio for avatar cropper #4453

Merged
merged 1 commit into from
Jun 19, 2024
Merged

Conversation

haileyok
Copy link
Member

Why

Avatar cropping on Android is not great right now, since the current logic requires the new image be the same size as whatever the input is. For example, a 3000x1500 input will expect an image of that same aspect when cropping. This doesn't work very well for avatar crops.

Screen.Recording.2024-06-09.at.9.44.56.PM.mov

How

Instead of using the input picture's height and width, we should just set this to a size with equal height and width. We'll use 1000x1000 for now. This ends up allowing us to crop to whatever region of the photo we want.

Screen.Recording.2024-06-09.at.9.45.53.PM.mov

Test Plan

  • Verify that crops still work correctly on Android on various devices
  • Verify that iOS cropping still behaves the same as before
RocketSim_Recording_iPhone_15_Pro_Max_6.7_2024-06-09_21.48.21.mp4
  • Verify that cropping on web still behaves the same as before
Screen.Recording.2024-06-09.at.9.50.20.PM.mov

Copy link

render bot commented Jun 10, 2024

Copy link

Old size New size Diff
7.39 MB 7.39 MB -18 B (-0.00%)

@haileyok haileyok changed the title use 1000x1000 for image size in avatar cropper Use a 1:1 ratio for avatar cropper Jun 10, 2024
Copy link
Contributor

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works in my testing

@gaearon gaearon merged commit 89d99a8 into main Jun 19, 2024
6 checks passed
@gaearon gaearon deleted the hailey/crop-aspect-ratio-avatar branch June 19, 2024 23:20
estrattonbailey added a commit that referenced this pull request Jun 19, 2024
* origin/main:
  Convert button to use forwardRef (#4576)
  use 1000x1000 for image height in avatar cropper (#4453)
  fix for autofill covering border (#4573)
estrattonbailey added a commit that referenced this pull request Jun 20, 2024
* origin/main: (62 commits)
  Rework "Who can reply" to blend more nicely into the UI (#4578)
  Fix threadgate read after write (#4577)
  Convert button to use forwardRef (#4576)
  use 1000x1000 for image height in avatar cropper (#4453)
  fix for autofill covering border (#4573)
  Update HomeHeaderLayoutMobile.tsx (#4572)
  Option for large alt badges (#4571)
  Truncate post metrics and fix truncation on native (#4575)
  Fix avi placeholder layout (#4570)
  add support for `ListEmptyComponent`, allow `undefined` data (#4403)
  GIF previews in notifications (#4447)
  [Session] Convert account to session data explicitly (#4446)
  Move onboarding start to after successfull account creation (#4381)
  Collection of moderation fixes (#4566)
  Fix undefined block (#4479)
  fix gap between tab bar and its border (#4538)
  Better handling of blocks in `KnownFollowers` (#4563)
  Verify email reminders (#4510)
  Bump labeler limit to 20 (#4565)
  Migrate local thread mutes (#4523)
  ...
estrattonbailey added a commit that referenced this pull request Jun 20, 2024
* origin/main: (25 commits)
  Add a11y context (#4586)
  center pill text in label pill (#4579)
  Wait for AppView when posting (#4584)
  Bsky link card service (#4547)
  Merge #4492, fixes profile menu hover (#4580)
  Rework "Who can reply" to blend more nicely into the UI (#4578)
  Fix threadgate read after write (#4577)
  Convert button to use forwardRef (#4576)
  use 1000x1000 for image height in avatar cropper (#4453)
  fix for autofill covering border (#4573)
  Update HomeHeaderLayoutMobile.tsx (#4572)
  Option for large alt badges (#4571)
  Truncate post metrics and fix truncation on native (#4575)
  Fix avi placeholder layout (#4570)
  add support for `ListEmptyComponent`, allow `undefined` data (#4403)
  GIF previews in notifications (#4447)
  [Session] Convert account to session data explicitly (#4446)
  Move onboarding start to after successfull account creation (#4381)
  Collection of moderation fixes (#4566)
  Fix undefined block (#4479)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants