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

refactor:简化头像计算,新增头像最大尺寸参数,避免头像裁剪出来太大 || refactor: Simplify the avatar calculation and add a new avatar. Maximum size parameter to prevent the avatar from being cropped too large #199

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

hxg2050
Copy link

@hxg2050 hxg2050 commented Jan 11, 2024

使用的时候遇到提示文件太大,但是手机上的照片动辄10m+,优化了一下裁剪头像,现在选择本地图片可以选择更大的图片了


When using it, I encountered a prompt that the file is too large, but the photos on the mobile phone are often 10m+. I have optimized the cropped avatar. Now you can choose a larger image when selecting a local image.

Copy link

netlify bot commented Jan 11, 2024

Deploy Preview for tailchat-nightly ready!

Name Link
🔨 Latest commit c8e5102
🔍 Latest deploy log https://app.netlify.com/sites/tailchat-nightly/deploys/65a09f4d2b053800087827a6
😎 Deploy Preview https://deploy-preview-199--tailchat-nightly.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot changed the title refactor:简化头像计算,新增头像最大尺寸参数,避免头像裁剪出来太大 refactor:简化头像计算,新增头像最大尺寸参数,避免头像裁剪出来太大 || refactor: Simplify the avatar calculation and add a new avatar. Maximum size parameter to prevent the avatar from being cropped too large Jan 11, 2024
0,
0,
size,
size
);
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is design for common image cropper not only for avatar. for example: group background.

maybe you can check component in client/web/src/components/ImageUploader.tsx#AvatarUploader

Copy link
Author

Choose a reason for hiding this comment

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

I see, understanding

@moonrailgun
Copy link
Contributor

I dont know why you continue wanna change algorithm

This pr has two problem:

  • the safe area algorithm is to make sure the behavior of crop and rotate logic is work fine and not lost information. i dont know why you wanna delete it, because it looks like you just wanna set a max width to make sure image size is safe.
  • and you should pass your props(maxSize in your code) from avatar picker into this crop function. if you just only add a param, its will not be work.

if you can not cover it, free feel to tell me, i can merge it and change this logic work fine

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.

2 participants