fix: use thumbnail url as default placeholder image if piexelate fails
This commit is contained in:
parent
210181a066
commit
b5491f00c5
|
@ -30,9 +30,10 @@ export class PlaceholderService {
|
||||||
|
|
||||||
if (this.exists(fileName)) return this.cache.get(fileName) as string
|
if (this.exists(fileName)) return this.cache.get(fileName) as string
|
||||||
|
|
||||||
|
const thumbnailPath = getStrapiImageUrlBySize('thumbnail', imagePath)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filePath = `${POSTS_IMAGE_PLACEHOLDER_DIR}/${fileName}`
|
const filePath = `${POSTS_IMAGE_PLACEHOLDER_DIR}/${fileName}`
|
||||||
const thumbnailPath = getStrapiImageUrlBySize('thumbnail', imagePath)
|
|
||||||
const imageUrl = transformStrapiImageUrl(thumbnailPath)
|
const imageUrl = transformStrapiImageUrl(thumbnailPath)
|
||||||
const imageBuffer = (
|
const imageBuffer = (
|
||||||
await axios({ url: imageUrl, responseType: 'arraybuffer' })
|
await axios({ url: imageUrl, responseType: 'arraybuffer' })
|
||||||
|
@ -57,6 +58,6 @@ export class PlaceholderService {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ''
|
return thumbnailPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue