get-image-url-debug

This commit is contained in:
Untone 2024-01-23 18:27:04 +03:00
parent 504d3faefc
commit 2db840bba5

View File

@ -15,12 +15,16 @@ export const getImageUrl = (
src: string, src: string,
options: { width?: number; height?: number; noSizeUrlPart?: boolean } = {}, options: { width?: number; height?: number; noSizeUrlPart?: boolean } = {},
) => { ) => {
console.debug(src)
const filename = src.split('/')[-1] const filename = src.split('/')[-1]
const isAudio = src.toLowerCase().split('.')[-1] in ['wav', 'mp3', 'ogg', 'aif', 'flac'] const isAudio = src.toLowerCase().split('.')[-1] 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)
return `${base}${sizeUrlPart}production/${isAudio ? 'audio' : 'image'}/${filename}` const res = `${base}${sizeUrlPart}production/${isAudio ? 'audio' : 'image'}/${filename}`
console.debug(res)
return res
} }
export const getOpenGraphImageUrl = ( export const getOpenGraphImageUrl = (