get-image-url-fixed
This commit is contained in:
parent
2db840bba5
commit
90e02675ba
|
@ -15,14 +15,14 @@ export const getImageUrl = (
|
||||||
src: string,
|
src: string,
|
||||||
options: { width?: number; height?: number; noSizeUrlPart?: boolean } = {},
|
options: { width?: number; height?: number; noSizeUrlPart?: boolean } = {},
|
||||||
) => {
|
) => {
|
||||||
console.debug(src)
|
//console.debug(src)
|
||||||
const filename = src.split('/')[-1]
|
const filename = src.split('/').pop()
|
||||||
const isAudio = src.toLowerCase().split('.')[-1] in ['wav', 'mp3', 'ogg', 'aif', 'flac']
|
const isAudio = src.toLowerCase().split('.').pop() in ['wav', 'mp3', 'ogg', 'aif', 'flac']
|
||||||
const base = isAudio ? cdnUrl : `${thumborUrl}/unsafe/`
|
const base = isAudio ? cdnUrl : `${thumborUrl}/unsafe/`
|
||||||
const sizeUrlPart = isAudio ? '' : getSizeUrlPart(options)
|
const sizeUrlPart = isAudio ? '' : getSizeUrlPart(options)
|
||||||
|
|
||||||
const res = `${base}${sizeUrlPart}production/${isAudio ? 'audio' : 'image'}/${filename}`
|
const res = `${base}${sizeUrlPart}production/${isAudio ? 'audio' : 'image'}/${filename}`
|
||||||
console.debug(res)
|
//console.debug(res)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user