From 7d1065a284dd72a58a220ee7b52ffc1bf624e734 Mon Sep 17 00:00:00 2001 From: amirhouieh Date: Mon, 22 Jan 2024 14:57:51 +0100 Subject: [PATCH] disable pixalation for vercel --- src/services/strapi/transformers/utils.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services/strapi/transformers/utils.ts b/src/services/strapi/transformers/utils.ts index bdfc59c..b02d4db 100644 --- a/src/services/strapi/transformers/utils.ts +++ b/src/services/strapi/transformers/utils.ts @@ -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 => { 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) : '', } }