piece of strapi integration

This commit is contained in:
tmshv committed 2021-02-13 19:01:34 +03:00
1 parent 00197d4f9a
commit 91982b8c99
7 files changed
+252 -16

No files matched your search

+3 -1
View File
@@ -3,14 +3,16 @@ import { ImageSize } from 'src/types'
export type ResizeOptions = {
width: number
height: number
n?: number
}
export function getResizedUrl(src: string, options: ResizeOptions): string {
const n = options.n ?? 1
if (!src || src === '') {
return null
}
return `https://images.weserv.nl/?url=${src}&w=${options.width}&h=${options.height}&n=-1`
return `http://images.weserv.nl/?url=${src}&w=${options.width}&h=${options.height}&n=${n}`
}
export function imageSrcSet(src: string, sizes: ImageSize[]): string {