Skip to content

Commit

Permalink
fix: 桌面端查看表情图片缩略图显示错误
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Dec 16, 2024
1 parent 2318877 commit 008653e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions electron/render/viewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@
const {ipcRenderer} = require('electron');

const thumbnailUrl = (url) => {
url = `${url}`
.replace(/_thumb\.(png|jpg|jpeg)$/, '')
.replace(/\/crop\/([^\/]+)$/, '')
if (!/^https?:\/\/[^\/]+\/uploads\//.test(url)) {
return url
}
const crops = {
ratio: 3,
percentage: '320x0'
}
url = `${url}`
.replace(/_thumb\.(png|jpg|jpeg)$/, '')
.replace(/\/crop\/([^\/]+)$/, '')
return url + "/crop/" + Object.keys(crops).map(key => {
return `${key}:${crops[key]}`
}).join(",")
Expand Down

0 comments on commit 008653e

Please sign in to comment.