Skip to content

Commit aafec71

Browse files
authored
automatically add layout=fill as fallback
1 parent f464985 commit aafec71

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

package-lock.json

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
22
"name": "@bitpatty/next-image-s3-imgproxy-loader",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "imgproxy S3 extension for next/image",
55
"author": "Matteias Collet <matteias.collet@bluewin.ch>",
66
"main": "dist/index.js",
77
"scripts": {
88
"build": "rimraf dist && rollup -c"
99
},
10+
"engines": {
11+
"node": ">=15.7.0"
12+
},
1013
"repository": {
1114
"type": "git",
1215
"url": "https://github.com/BitPatty/next-image-s3-imgproxy-loader.git"

src/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,14 @@ const ProxyImage = ({
116116
return `${IMGPROXY_ENDPOINT}?${urlParams.toString()}`;
117117
};
118118

119-
return <Image src={file} loader={imageLoader} {...props} />;
119+
return (
120+
<Image
121+
src={file}
122+
loader={imageLoader}
123+
{...(props.width == null && !props.layout ? { layout: 'fill' } : {})}
124+
{...props}
125+
/>
126+
);
120127
};
121128

122129
export default ProxyImage;

0 commit comments

Comments
 (0)