File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 11import Image , { ImageProps } from 'next/image' ;
22import React from 'react' ;
3+ import {
4+ PLACEHOLDER_SIZE_FALLBACK ,
5+ PLACEHOLDER_SIZE_MULTIPLIER
6+ } from '../utils/constants' ;
37import { getInt } from '../utils/helpers' ;
48import { uploadcareLoader } from '../utils/loader' ;
59
@@ -12,7 +16,9 @@ const generateBlurDataUrl = (
1216 width : ImageProps [ 'width' ]
1317) : string => {
1418 const imageWidth = getInt ( width ) ;
15- const blurImageWidth = imageWidth ? Math . ceil ( imageWidth * 0.01 ) : 10 ;
19+ const blurImageWidth = imageWidth
20+ ? Math . ceil ( imageWidth * PLACEHOLDER_SIZE_MULTIPLIER )
21+ : PLACEHOLDER_SIZE_FALLBACK ;
1622 return uploadcareLoader ( {
1723 src : src ,
1824 width : blurImageWidth ,
Original file line number Diff line number Diff line change @@ -3,3 +3,5 @@ export const MAX_OUTPUT_JPEG_IMAGE_DIMENSION = 5000;
33export const NOT_PROCESSED_EXTENSIONS = [ 'svg' , 'gif' ] ;
44export const DEFAULT_PARAMS = [ 'format/auto' , 'stretch/off' , 'progressive/yes' ] ;
55export const DEFAULT_CDN_DOMAIN = 'ucarecdn.com' ;
6+ export const PLACEHOLDER_SIZE_MULTIPLIER = 0.01 ;
7+ export const PLACEHOLDER_SIZE_FALLBACK = 10 ;
You can’t perform that action at this time.
0 commit comments