Use webp for thumbnails when available

This commit is contained in:
Zed
2023-01-09 00:29:59 +01:00
parent 88c6135030
commit cd163b26a3
3 changed files with 13 additions and 14 deletions

View File

@@ -7,14 +7,7 @@ import renderutils
import ".."/[types, utils, formatters]
import general
const
doctype = "<!DOCTYPE html>\n"
proc getSmallPic(url: string): string =
result = url
if "?" notin url and not url.endsWith("placeholder.png"):
result &= "?name=small"
result = getPicUrl(result)
const doctype = "<!DOCTYPE html>\n"
proc renderMiniAvatar(user: User; prefs: Prefs): VNode =
let url = getPicUrl(user.getUserPic("_mini"))
@@ -60,9 +53,8 @@ proc renderAlbum(tweet: Tweet): VNode =
tdiv(class="attachment image"):
let
named = "name=" in photo
orig = photo
small = if named: photo else: photo & "?name=small"
a(href=getOrigPicUrl(orig), class="still-image", target="_blank"):
small = if named: photo else: photo & smallWebp
a(href=getOrigPicUrl(photo), class="still-image", target="_blank"):
genImg(small)
proc isPlaybackEnabled(prefs: Prefs; playbackType: VideoType): bool =