Skip to content

Commit

Permalink
fix: use ratio in getSizes
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Jan 26, 2021
1 parent 7d83448 commit 8e5b658
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ function getSizes (ctx: ImageCTX, input: string, opts: GetSizesOptions) {
.sort((s1, s2) => s1 - s2) // unique & lowest to highest

const sizes = []
const ratio = opts.height / opts.width

for (const width of widths) {
const height = (opts.height / opts.width) || opts.height
const height = ratio ? Math.round(opts.width * ratio) : opts.height
sizes.push({
width,
height,
Expand Down

0 comments on commit 8e5b658

Please sign in to comment.