Skip to content

Commit

Permalink
perf: optimize small size image display
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Aug 31, 2023
1 parent 39879c1 commit c4d3d8c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/web/plugins/com.msgbyte.bbcode/src/tags/ImgTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ function parseImageAttr(attr: { height: string; width: string }): {
return {};
}

if (height <= MAX_HEIGHT && width <= MAX_WIDTH) {
return {
height,
width,
};
}

const ratio = Math.max(height / MAX_HEIGHT, width / MAX_WIDTH);

return {
Expand Down

0 comments on commit c4d3d8c

Please sign in to comment.