disable pixalation for vercel

This commit is contained in:
amirhouieh 2024-01-22 14:57:51 +01:00
parent b8c4b37cb5
commit 7d1065a284
No known key found for this signature in database
GPG Key ID: 96A18489765C51DD
1 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import { PlaceholderService } from '@/services/images.service'
import { isVercel } from '@/utils/env.utils'
import * as htmlParser from 'node-html-parser'
import slugify from 'slugify'
import { UploadFileEntity } from '../../../lib/strapi/strapi.generated'
@ -30,6 +31,7 @@ export const transformStrapiImageData = async (
image: StrapiImage,
): Promise<LPE.Image.Document> => {
const attributes = 'data' in image ? image.data.attributes : image.attributes
return {
height: attributes.height || 0,
width: attributes.width || 0,
@ -37,7 +39,12 @@ export const transformStrapiImageData = async (
alt: attributes.caption || attributes.alternativeText || '',
url: attributes.url ? transformStrapiImageUrl(attributes.url) : '',
placeholder: attributes.url
? await placeholderService.pixelate(attributes.url)
? isVercel()
? getStrapiImageUrlBySize(
'thumbnail',
transformStrapiImageUrl(attributes.url),
)
: await placeholderService.pixelate(attributes.url)
: '',
}
}