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

Adding an avatar by an authorized user #567

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AlexanderKireev
Copy link

@AlexanderKireev AlexanderKireev commented Nov 15, 2024

#546
Загружаем и конвертируем аватар из jpg/jpeg, bmp, png в jpeg 250px x 250px, сохраняем в формате base64 в таблице user-settings, храним состояние в userSettingsSlice. После конвертации размер картинки не превышает 250kb-300kb.

record_avatar.mp4

@@ -26,6 +26,11 @@ export class BackendUserSettings1730013613468 implements MigrationInterface {
type: 'varchar(50)',
isNullable: false,
},
{
name: 'avatar_img',
Copy link
Contributor

Choose a reason for hiding this comment

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

@AlexanderKireev в каком формате будет храниться картинка? Это URL, base64 или svg-код??

Copy link
Author

@AlexanderKireev AlexanderKireev Nov 15, 2024

Choose a reason for hiding this comment

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

@fey Если пользователь зарегистрировался, то base64 (размер не более 250кб после сжатия). Если пользователь зашел с GitHub, то URL (https://github.com/${username}.png). Второй вариант я еще не доделал.

Copy link
Contributor

Choose a reason for hiding this comment

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

@AlexanderKireev если в таблице лежит именно base64, то давайте сменим имя поля например на avatar_base64, исходя из этого нам понятно будет, что внутри, что это не url

Copy link
Author

Choose a reason for hiding this comment

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

@fey Хорошо, поменяю.

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