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 1
1
import Image , { ImageProps } from 'next/image' ;
2
2
import React from 'react' ;
3
+ import {
4
+ PLACEHOLDER_SIZE_FALLBACK ,
5
+ PLACEHOLDER_SIZE_MULTIPLIER
6
+ } from '../utils/constants' ;
3
7
import { getInt } from '../utils/helpers' ;
4
8
import { uploadcareLoader } from '../utils/loader' ;
5
9
@@ -12,7 +16,9 @@ const generateBlurDataUrl = (
12
16
width : ImageProps [ 'width' ]
13
17
) : string => {
14
18
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 ;
16
22
return uploadcareLoader ( {
17
23
src : src ,
18
24
width : blurImageWidth ,
Original file line number Diff line number Diff line change @@ -3,3 +3,5 @@ export const MAX_OUTPUT_JPEG_IMAGE_DIMENSION = 5000;
3
3
export const NOT_PROCESSED_EXTENSIONS = [ 'svg' , 'gif' ] ;
4
4
export const DEFAULT_PARAMS = [ 'format/auto' , 'stretch/off' , 'progressive/yes' ] ;
5
5
export 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