From 906eddc61f026111e25efe97309f39250f8f5728 Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 8 May 2016 17:29:23 +0200 Subject: [PATCH] server/users: change avatars to PNG --- server/szurubooru/func/users.py | 4 ++-- server/szurubooru/tests/api/test_user_creating.py | 2 +- server/szurubooru/tests/api/test_user_updating.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/szurubooru/func/users.py b/server/szurubooru/func/users.py index 168cc5e7..b2151e30 100644 --- a/server/szurubooru/func/users.py +++ b/server/szurubooru/func/users.py @@ -30,7 +30,7 @@ def serialize_user(user, authenticated_user, force_show_email=False): util.get_md5((user.email or user.name).lower()), config.config['thumbnails']['avatar_width']) else: - ret['avatarUrl'] = '%s/avatars/%s.jpg' % ( + ret['avatarUrl'] = '%s/avatars/%s.png' % ( config.config['data_url'].rstrip('/'), user.name.lower()) if authenticated_user.user_id != user.user_id \ @@ -146,7 +146,7 @@ def update_user_avatar(user, avatar_style, avatar_content): image.resize_fill( int(config.config['thumbnails']['avatar_width']), 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: raise InvalidAvatarError( 'Avatar style %r is invalid. Valid avatar styles: %r.' % ( diff --git a/server/szurubooru/tests/api/test_user_creating.py b/server/szurubooru/tests/api/test_user_creating.py index d92b955f..64419a63 100644 --- a/server/szurubooru/tests/api/test_user_creating.py +++ b/server/szurubooru/tests/api/test_user_creating.py @@ -226,4 +226,4 @@ def test_uploading_avatar(test_ctx, tmpdir): user = users.get_user_by_name('chewie') assert user.avatar_style == user.AVATAR_MANUAL assert response['user']['avatarUrl'] == \ - 'http://example.com/data/avatars/chewie.jpg' + 'http://example.com/data/avatars/chewie.png' diff --git a/server/szurubooru/tests/api/test_user_updating.py b/server/szurubooru/tests/api/test_user_updating.py index 40230bbd..f11e7552 100644 --- a/server/szurubooru/tests/api/test_user_updating.py +++ b/server/szurubooru/tests/api/test_user_updating.py @@ -202,4 +202,4 @@ def test_uploading_avatar(test_ctx, tmpdir): user = users.get_user_by_name('u1') assert user.avatar_style == user.AVATAR_MANUAL assert response['user']['avatarUrl'] == \ - 'http://example.com/data/avatars/u1.jpg' + 'http://example.com/data/avatars/u1.png'