merge-requests/30/head
Bob Mottram 2024-02-05 19:07:55 +00:00
parent a53d46ff34
commit 3716a42132
1 changed files with 10 additions and 22 deletions

View File

@ -146,28 +146,16 @@ def set_profile_image(base_dir: str, http_prefix: str,
media_type = 'image/png' media_type = 'image/png'
icon_filename = icon_filename_base + '.png' icon_filename = icon_filename_base + '.png'
if image_filename.endswith('.jpg') or \ extensions = get_image_extensions()
image_filename.endswith('.jpeg'): for ext in extensions:
media_type = 'image/jpeg' if image_filename.endswith('.' + ext):
icon_filename = icon_filename_base + '.jpg' media_type = 'image/' + ext
elif image_filename.endswith('.gif'): if ext == 'svg':
media_type = 'image/gif' media_type = 'image/' + ext + '+xml'
icon_filename = icon_filename_base + '.gif' elif ext == 'jpg':
elif image_filename.endswith('.webp'): media_type = 'image/jpeg'
media_type = 'image/webp' icon_filename = icon_filename_base + '.' + ext
icon_filename = icon_filename_base + '.webp'
elif image_filename.endswith('.avif'):
media_type = 'image/avif'
icon_filename = icon_filename_base + '.avif'
elif image_filename.endswith('.heic'):
media_type = 'image/heic'
icon_filename = icon_filename_base + '.heic'
elif image_filename.endswith('.jxl'):
media_type = 'image/jxl'
icon_filename = icon_filename_base + '.jxl'
elif image_filename.endswith('.svg'):
media_type = 'image/svg+xml'
icon_filename = icon_filename_base + '.svg'
profile_filename = acct_handle_dir(base_dir, handle) + '/' + icon_filename profile_filename = acct_handle_dir(base_dir, handle) + '/' + icon_filename
person_json = load_json(person_filename) person_json = load_json(person_filename)