Re-added webp fallback

This commit is contained in:
BordedDev 2025-05-17 13:29:25 +02:00
parent ffb22165da
commit 1bed47fbf5
No known key found for this signature in database
GPG Key ID: C5F495EAE56673BF

View File

@ -181,7 +181,7 @@ def enrich_image_rendering(text):
soup = BeautifulSoup(text, "html.parser")
for element in soup.find_all("img"):
if element.attrs["src"].startswith("/"):
element.attrs["src"] += "?width=240&height=240"
element.attrs["src"] += "?width=240&height=240&format=webp"
picture_template = f'''
<picture>
<source srcset="{element.attrs["src"]}" type="{mimetypes.guess_type(element.attrs["src"])[0]}" />