Commit 28c8688b by linjinhong

fix:修改超过压板但是没有像素的图片

parent f580dede
......@@ -498,14 +498,16 @@ async function checkImageOutsideGrid() {
// ===================== 第二步:Sharp 读取图片原始像素 =====================
let imgSource = imgDom.src;
console.log("imgSource", imgSource);
if (imgSource.startsWith("file://")) {
console.log(111);
imgSource = new URL(imgSource).pathname;
if (process.platform === "win32") {
imgSource = imgSource.slice(1);
}
imgSource = decodeURIComponent(imgSource);
}
console.log("imgSource", imgSource);
const sharpImg = sharp(imgSource);
const imgMetadata = await sharpImg.metadata();
......
......@@ -831,6 +831,8 @@ export default {
this.isOver = hasOutsideValidPixel;
} else if (!isImageBiggerThanGrid) {
this.isOver = isImageBiggerThanGrid;
} else if (isImageBiggerThanGrid && !hasOutsideValidPixel) {
this.isOver = hasOutsideValidPixel;
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment