Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
electron-printer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhuzhequan
electron-printer
Commits
28c8688b
Commit
28c8688b
authored
Mar 27, 2026
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修改超过压板但是没有像素的图片
parent
f580dede
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
src/server/utils/setImage.js
+4
-2
src/views/design/main/index.vue
+2
-0
No files found.
src/server/utils/setImage.js
View file @
28c8688b
...
@@ -498,14 +498,16 @@ async function checkImageOutsideGrid() {
...
@@ -498,14 +498,16 @@ async function checkImageOutsideGrid() {
// ===================== 第二步:Sharp 读取图片原始像素 =====================
// ===================== 第二步:Sharp 读取图片原始像素 =====================
let
imgSource
=
imgDom
.
src
;
let
imgSource
=
imgDom
.
src
;
console
.
log
(
"imgSource"
,
imgSource
);
if
(
imgSource
.
startsWith
(
"file://"
))
{
if
(
imgSource
.
startsWith
(
"file://"
))
{
console
.
log
(
111
);
imgSource
=
new
URL
(
imgSource
).
pathname
;
imgSource
=
new
URL
(
imgSource
).
pathname
;
if
(
process
.
platform
===
"win32"
)
{
if
(
process
.
platform
===
"win32"
)
{
imgSource
=
imgSource
.
slice
(
1
);
imgSource
=
imgSource
.
slice
(
1
);
}
}
imgSource
=
decodeURIComponent
(
imgSource
);
}
}
console
.
log
(
"imgSource"
,
imgSource
);
const
sharpImg
=
sharp
(
imgSource
);
const
sharpImg
=
sharp
(
imgSource
);
const
imgMetadata
=
await
sharpImg
.
metadata
();
const
imgMetadata
=
await
sharpImg
.
metadata
();
...
...
src/views/design/main/index.vue
View file @
28c8688b
...
@@ -831,6 +831,8 @@ export default {
...
@@ -831,6 +831,8 @@ export default {
this
.
isOver
=
hasOutsideValidPixel
;
this
.
isOver
=
hasOutsideValidPixel
;
}
else
if
(
!
isImageBiggerThanGrid
)
{
}
else
if
(
!
isImageBiggerThanGrid
)
{
this
.
isOver
=
isImageBiggerThanGrid
;
this
.
isOver
=
isImageBiggerThanGrid
;
}
else
if
(
isImageBiggerThanGrid
&&
!
hasOutsideValidPixel
)
{
this
.
isOver
=
hasOutsideValidPixel
;
}
}
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment