Skip to content

Commit

Permalink
fix: use correct width and handle x2
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Jan 26, 2021
1 parent 8e5b658 commit 97e3889
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ function getSizes (ctx: ImageCTX, input: string, opts: GetSizesOptions) {
let widths = [].concat(opts.sizes || ctx.options.sizes)
if (opts.width) {
widths.push(opts.width)
widths.push(opts.width * 2)
widths = widths.filter(w => w <= opts.width)
widths.push(opts.width * 2)
}
widths = Array.from(new Set(widths))
.sort((s1, s2) => s1 - s2) // unique & lowest to highest
Expand All @@ -148,7 +148,7 @@ function getSizes (ctx: ImageCTX, input: string, opts: GetSizesOptions) {
const ratio = opts.height / opts.width

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

0 comments on commit 97e3889

Please sign in to comment.