misc: appropriately size images
This commit is contained in:
1 parent
ad3b9e5f36
commit
6bc3c0bd94
2 files changed
+5
-5
No files matched your search
@@ -21,9 +21,9 @@ export const bestImageURL = (
|
||||
return `${post.thumbnail_url}?thumbnail=512&format=webp`
|
||||
else if (compact && post.url) return `${post.url}?thumbnail=512&format=webp`
|
||||
|
||||
if (post.url) return `${post.url}?thumbnail=${width * 2}&format=webp`
|
||||
if (post.url) return `${post.url}?thumbnail=${width}&format=webp`
|
||||
else if (post.thumbnail_url)
|
||||
return `${post.thumbnail_url}?thumbnail=${width * 2}&format=webp`
|
||||
return `${post.thumbnail_url}?thumbnail=${width}&format=webp`
|
||||
|
||||
return post.url ?? ''
|
||||
}
|
||||
@@ -37,7 +37,7 @@ export const optimizeImageURL = (
|
||||
url.searchParams.append('format', 'webp')
|
||||
url.searchParams.append(
|
||||
'thumbnail',
|
||||
findClosestNumber([128, 256, 512, 1024], width * 2).toString()
|
||||
findClosestNumber([128, 256, 512, 728, 1024, 1536], width).toString()
|
||||
)
|
||||
return url.toString()
|
||||
} catch (e) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { createAvatar } from '@dicebear/core'
|
||||
import * as initials from '@dicebear/initials'
|
||||
|
||||
const sizes = [48, 64, 128, 256, 512]
|
||||
const sizes = [16, 32, 48, 64, 128, 256, 512]
|
||||
|
||||
export let url: string | undefined
|
||||
export let alt: string = ''
|
||||
@@ -21,7 +21,7 @@
|
||||
urlObj.searchParams.append('format', 'webp')
|
||||
urlObj.searchParams.append(
|
||||
'thumbnail',
|
||||
findClosestNumber(sizes, (res || width) * 2).toString()
|
||||
findClosestNumber(sizes, res || width).toString()
|
||||
)
|
||||
|
||||
return urlObj.toString()
|
||||
|
||||
Reference in new issue
Block a user