Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit 83dca80

Browse files
authored
Merge pull request #177 from Cyclonecode/fix/remove-deprecation-warnings
Do not use deprecated functions
2 parents 530cf12 + e8a49b5 commit 83dca80

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib/image.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ export async function resize (buffer, width, height) {
2626
const transformer = sharp(buffer);
2727

2828
if (width || height) {
29-
transformer.resize(width, height).max().withoutEnlargement();
29+
const options = {
30+
withoutEnlargement: true,
31+
fit: sharp.fit.inside
32+
}
33+
transformer.resize(width, height, options)
3034
}
3135

3236
return transformer.toBuffer();
@@ -61,4 +65,4 @@ export async function crop (buffer, width, height, x, y) {
6165
} catch (err) {
6266
console.log(err);
6367
}
64-
}
68+
}

0 commit comments

Comments
 (0)