Skip to content

Commit

Permalink
feat: supported more resize options (only sharp) (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
RAX7 authored Sep 16, 2022
1 parent c3c4a30 commit d365db3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1015,15 +1015,15 @@ async function sharpTransform(

// ====== resize ======

if (
minimizerOptions.resize &&
(minimizerOptions.resize.width || minimizerOptions.resize.height) &&
minimizerOptions.resize.enabled !== false
) {
imagePipeline.resize(
minimizerOptions.resize.width,
minimizerOptions.resize.height
);
if (minimizerOptions.resize) {
const { enabled = true, ...params } = minimizerOptions.resize;

if (
enabled &&
(typeof params.width === "number" || typeof params.height === "number")
) {
imagePipeline.resize(params);
}
}

// ====== convert ======
Expand Down

0 comments on commit d365db3

Please sign in to comment.