diff --git a/package.json b/package.json index 4a4824ef38d1fef82119e8e865fbae8b1b179b07..005d45da7822b420956bcb9b2cf62770772f2a55 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@types/node": "^10.5.2", "@types/ratelimiter": "^2.1.28", "@types/redis": "^2.8.5", - "@types/sharp": "^0.17.6", + "@types/sharp": "^0.21.0", "lodash": "^4.17.12", "mocha": "^5.1.1", "mocha-junit-reporter": "^1.17.0", diff --git a/src/proxy.ts b/src/proxy.ts index 2761626d0f39e0d3fd307c7b2261e095c16ee1fb..7a5e876a2d482578447344bdc3030df6f95c3073 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -325,7 +325,7 @@ export async function proxyHandler(ctx: KoaContext) { if (!width) { width = maxWidth } if (!height) { height = maxHeight } - image.rotate().resize(width, height).max().withoutEnlargement() + image.rotate().resize(width, height, { fit: 'inside', withoutEnlargement: true }) break } diff --git a/yarn.lock b/yarn.lock index 4b08e8acc48afa7d4cf80696fc308c931bb1a5db..d6c0358a7bf689ed0cc43ff685e517e252824ff7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -286,10 +286,10 @@ "@types/express-serve-static-core" "*" "@types/mime" "*" -"@types/sharp@^0.17.6": - version "0.17.10" - resolved "https://registry.yarnpkg.com/@types/sharp/-/sharp-0.17.10.tgz#4f546861c53fae2b1bffcdd1ae7e691cc68afa52" - integrity sha512-nISitptrYm6hUpiC+vN21cbT8Of54TubXY95N+pcqNCmmXZqd1hRk7fC5HYRRQwWJiKV/NLHx8f4CxPIsIQXqg== +"@types/sharp@^0.21.0": + version "0.21.3" + resolved "https://registry.yarnpkg.com/@types/sharp/-/sharp-0.21.3.tgz#82f89f99536557e397c0c46f5ea50dcc1529fe35" + integrity sha512-wgCw1OO/iQ3w13WVRhx1fHoo5NDHq+444wqTnKcAWA9YMj1a9stoLlfLjW1mJJkFG1aRjeKd9KYhiYOJ3H7qEg== dependencies: "@types/node" "*"