Use small image version for preview to save memory

This commit is contained in:
Zed 2020-06-07 07:57:32 +02:00
parent 34dd02df1b
commit 9c8c2cbe88
2 changed files with 9 additions and 6 deletions

View File

@ -16,7 +16,7 @@ proc renderProfileCard*(profile: Profile; prefs: Prefs): VNode =
tdiv(class="profile-card-info"): tdiv(class="profile-card-info"):
let url = getPicUrl(profile.getUserPic()) let url = getPicUrl(profile.getUserPic())
a(class="profile-card-avatar", href=url, target="_blank"): a(class="profile-card-avatar", href=url, target="_blank"):
genImg(profile.getUserpic("_200x200")) genImg(profile.getUserpic("_400x400"))
tdiv(class="profile-card-tabs-name"): tdiv(class="profile-card-tabs-name"):
linkUser(profile, class="profile-card-fullname") linkUser(profile, class="profile-card-fullname")
@ -72,8 +72,9 @@ proc renderPhotoRail(profile: Profile; photoRail: PhotoRail): VNode =
tdiv(class="photo-rail-grid"): tdiv(class="photo-rail-grid"):
for i, photo in photoRail: for i, photo in photoRail:
if i == 16: break if i == 16: break
let col = if photo.color.len > 0: photo.color else: "#161616"
a(href=(&"/{profile.username}/status/{photo.tweetId}#m"), a(href=(&"/{profile.username}/status/{photo.tweetId}#m"),
style={backgroundColor: photo.color}): style={backgroundColor: col}):
genImg(photo.url & (if "format" in photo.url: "" else: ":thumb")) genImg(photo.url & (if "format" in photo.url: "" else: ":thumb"))
proc renderBanner(profile: Profile): VNode = proc renderBanner(profile: Profile): VNode =

View File

@ -38,10 +38,12 @@ proc renderAlbum(tweet: Tweet): VNode =
tdiv(class="gallery-row", style={marginTop: margin}): tdiv(class="gallery-row", style={marginTop: margin}):
for photo in photos: for photo in photos:
tdiv(class="attachment image"): tdiv(class="attachment image"):
var url = photo let
if "=orig" notin url: url &= "?name=orig" named = "name=" in photo
a(href=getPicUrl(url), class="still-image", target="_blank"): orig = if named: photo else: photo & "?name=orig"
genImg(photo) small = if named: photo else: photo & "?name=small"
a(href=getPicUrl(orig), class="still-image", target="_blank"):
genImg(small)
proc isPlaybackEnabled(prefs: Prefs; video: Video): bool = proc isPlaybackEnabled(prefs: Prefs; video: Video): bool =
case video.playbackType case video.playbackType