#27 fix issue with description on lazy loaded images

This commit is contained in:
Alan Grainger
2025-05-09 21:47:39 +12:00
parent ea5889f7a6
commit 2bba8d7527
6 changed files with 24 additions and 48 deletions
+16 -7
View File
@@ -117,13 +117,22 @@ class Render {
// Add a download link for the original-size image, if configured in config.json
downloadUrl = immich.photoUrl(share.key, asset.id, ImageSize.original)
}
items.push({
previewUrl: immich.photoUrl(share.key, asset.id, ImageSize.preview),
downloadUrl,
thumbnailUrl: baseUrl + immich.photoUrl(share.key, asset.id, ImageSize.thumbnail),
video,
description: getConfigOption('ipp.showMetadata.description', false) && typeof asset?.exifInfo?.description === 'string' ? asset.exifInfo.description : ''
})
const thumbnailUrl = baseUrl + immich.photoUrl(share.key, asset.id, ImageSize.thumbnail)
const previewUrl = immich.photoUrl(share.key, asset.id, ImageSize.preview)
const description = getConfigOption('ipp.showMetadata.description', false) && typeof asset?.exifInfo?.description === 'string' ? asset.exifInfo.description.replace(/'/g, ''') : ''
// Create the full HTML element source to pass to the gallery view
const itemHtml = [
video ? `<a data-video='${video}'` : `<a href="${previewUrl}"`,
downloadUrl ? ` data-download-url="${downloadUrl}"` : '',
description ? ` data-sub-html='<p>${description}</p>'` : '',
`><img alt="" src="${thumbnailUrl}"/>`,
video ? '<div class="play-icon"></div>' : '',
'</a>'
].join('')
items.push(itemHtml)
}
res.render('gallery', {
items,