fix: use thumbnail url as default placeholder image if piexelate fails

This commit is contained in:
Hossein Mehrabi 2024-02-02 17:44:27 +03:30
parent 210181a066
commit b5491f00c5
No known key found for this signature in database
GPG Key ID: 45C04964191AFAA1
1 changed files with 3 additions and 2 deletions

View File

@ -30,9 +30,10 @@ export class PlaceholderService {
if (this.exists(fileName)) return this.cache.get(fileName) as string
const thumbnailPath = getStrapiImageUrlBySize('thumbnail', imagePath)
try {
const filePath = `${POSTS_IMAGE_PLACEHOLDER_DIR}/${fileName}`
const thumbnailPath = getStrapiImageUrlBySize('thumbnail', imagePath)
const imageUrl = transformStrapiImageUrl(thumbnailPath)
const imageBuffer = (
await axios({ url: imageUrl, responseType: 'arraybuffer' })
@ -57,6 +58,6 @@ export class PlaceholderService {
console.log(e)
}
return ''
return thumbnailPath
}
}