feat: update OptimizedImage for WebP originals and add getOriginalWebpUrl

This commit is contained in:
Kirill
2026-05-15 20:21:29 +05:00
parent dc448d6538
commit 56bdcc0351
2 changed files with 25 additions and 1 deletions
+8
View File
@@ -35,6 +35,14 @@ function buildFallbackSrc(src: string, width: number): string {
return `/uploads-resized/${pathPrefix}${parsed.uuid}.webp?w=${width}`
}
/** Get the original WebP URL for full-screen display (no resize) */
export function getOriginalWebpUrl(src: string): string {
const parsed = parseUploadUrl(src)
if (!parsed) return src
const pathPrefix = parsed.subdir ? `${parsed.subdir}/` : ''
return `/uploads/${pathPrefix}${parsed.uuid}.webp`
}
export function OptimizedImage({
src,
alt,