server/users: change avatars to PNG
This commit is contained in:
parent
da1386c7d2
commit
906eddc61f
3 changed files with 4 additions and 4 deletions
|
@ -30,7 +30,7 @@ def serialize_user(user, authenticated_user, force_show_email=False):
|
||||||
util.get_md5((user.email or user.name).lower()),
|
util.get_md5((user.email or user.name).lower()),
|
||||||
config.config['thumbnails']['avatar_width'])
|
config.config['thumbnails']['avatar_width'])
|
||||||
else:
|
else:
|
||||||
ret['avatarUrl'] = '%s/avatars/%s.jpg' % (
|
ret['avatarUrl'] = '%s/avatars/%s.png' % (
|
||||||
config.config['data_url'].rstrip('/'), user.name.lower())
|
config.config['data_url'].rstrip('/'), user.name.lower())
|
||||||
|
|
||||||
if authenticated_user.user_id != user.user_id \
|
if authenticated_user.user_id != user.user_id \
|
||||||
|
@ -146,7 +146,7 @@ def update_user_avatar(user, avatar_style, avatar_content):
|
||||||
image.resize_fill(
|
image.resize_fill(
|
||||||
int(config.config['thumbnails']['avatar_width']),
|
int(config.config['thumbnails']['avatar_width']),
|
||||||
int(config.config['thumbnails']['avatar_height']))
|
int(config.config['thumbnails']['avatar_height']))
|
||||||
files.save('avatars/' + user.name.lower() + '.jpg', image.to_jpeg())
|
files.save('avatars/' + user.name.lower() + '.png', image.to_png())
|
||||||
else:
|
else:
|
||||||
raise InvalidAvatarError(
|
raise InvalidAvatarError(
|
||||||
'Avatar style %r is invalid. Valid avatar styles: %r.' % (
|
'Avatar style %r is invalid. Valid avatar styles: %r.' % (
|
||||||
|
|
|
@ -226,4 +226,4 @@ def test_uploading_avatar(test_ctx, tmpdir):
|
||||||
user = users.get_user_by_name('chewie')
|
user = users.get_user_by_name('chewie')
|
||||||
assert user.avatar_style == user.AVATAR_MANUAL
|
assert user.avatar_style == user.AVATAR_MANUAL
|
||||||
assert response['user']['avatarUrl'] == \
|
assert response['user']['avatarUrl'] == \
|
||||||
'http://example.com/data/avatars/chewie.jpg'
|
'http://example.com/data/avatars/chewie.png'
|
||||||
|
|
|
@ -202,4 +202,4 @@ def test_uploading_avatar(test_ctx, tmpdir):
|
||||||
user = users.get_user_by_name('u1')
|
user = users.get_user_by_name('u1')
|
||||||
assert user.avatar_style == user.AVATAR_MANUAL
|
assert user.avatar_style == user.AVATAR_MANUAL
|
||||||
assert response['user']['avatarUrl'] == \
|
assert response['user']['avatarUrl'] == \
|
||||||
'http://example.com/data/avatars/u1.jpg'
|
'http://example.com/data/avatars/u1.png'
|
||||||
|
|
Loading…
Reference in a new issue