mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-09-14 14:52:26 +03:00
Only scale image bigger than 512px (#731)
This commit is contained in:
parent
20e1df43d0
commit
ce1e263d57
2 changed files with 5 additions and 0 deletions
|
@ -166,6 +166,9 @@ export function scaleDownImage(imageFile, width, height) {
|
|||
img.onload = () => {
|
||||
let newWidth = img.width;
|
||||
let newHeight = img.height;
|
||||
if (newHeight <= height && newWidth <= width) {
|
||||
resolve(imageFile);
|
||||
}
|
||||
|
||||
if (newHeight > height) {
|
||||
newWidth = Math.floor(newWidth * (height / newHeight));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue