fix: switch to webp by default
This commit is contained in:
1 file changed
+2
-2
@@ -12,7 +12,7 @@ export const bestImageURL = (
|
|||||||
post: Post,
|
post: Post,
|
||||||
thumbnail: boolean = true,
|
thumbnail: boolean = true,
|
||||||
width: number = 1024,
|
width: number = 1024,
|
||||||
format: 'avif' | 'webp' | null = 'avif',
|
format: 'avif' | 'webp' | null = 'webp',
|
||||||
) => {
|
) => {
|
||||||
if (post.thumbnail_url && (thumbnail || !post.url))
|
if (post.thumbnail_url && (thumbnail || !post.url))
|
||||||
return optimizeImageURL(post.thumbnail_url, width, format)
|
return optimizeImageURL(post.thumbnail_url, width, format)
|
||||||
@@ -24,7 +24,7 @@ export const bestImageURL = (
|
|||||||
export const optimizeImageURL = (
|
export const optimizeImageURL = (
|
||||||
urlStr: string,
|
urlStr: string,
|
||||||
width: number = 1024,
|
width: number = 1024,
|
||||||
format: 'avif' | 'webp' | null = 'avif',
|
format: 'avif' | 'webp' | null = 'webp',
|
||||||
): string => {
|
): string => {
|
||||||
try {
|
try {
|
||||||
const url = new URL(urlStr)
|
const url = new URL(urlStr)
|
||||||
|
|||||||
Reference in new issue
Block a user