Fix: cannot upload
This commit is contained in:
parent
783ceec8de
commit
c005b546ba
|
@ -6,23 +6,20 @@ function img(mainWindow, dir) {
|
|||
var ipc = electron.ipcMain
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
ipc.on('file-select', (e, args) => {
|
||||
dialog.showOpenDialog(
|
||||
null,
|
||||
{
|
||||
let fileNames = dialog.showOpenDialogSync(mainWindow, {
|
||||
properties: ['openFile', 'multiSelections'],
|
||||
title: '添付ファイルを選択',
|
||||
defaultPath: '.',
|
||||
filters: [
|
||||
{
|
||||
name: 'メディアファイル',
|
||||
extensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg', 'mp4', 'webm']
|
||||
extensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg', 'mp4', 'webm'],
|
||||
},
|
||||
{ name: '画像', extensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg'] },
|
||||
{ name: '動画', extensions: ['mp4', 'webm'] },
|
||||
{ name: '全てのファイル', extensions: ['*'] }
|
||||
]
|
||||
},
|
||||
fileNames => {
|
||||
{ name: '全てのファイル', extensions: ['*'] },
|
||||
],
|
||||
})
|
||||
if (!fileNames) {
|
||||
return false
|
||||
}
|
||||
|
@ -31,8 +28,6 @@ function img(mainWindow, dir) {
|
|||
var bin = fs.readFileSync(path, 'base64')
|
||||
e.sender.webContents.send('resizeJudgement', [bin, 'new'])
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
ipc.on('bmp-image', (e, args) => {
|
||||
Jimp.read(args[0], function (err, lenna) {
|
||||
|
@ -65,7 +60,7 @@ function img(mainWindow, dir) {
|
|||
console.log(text)
|
||||
Jimp.read(decodedFile, function (err, image) {
|
||||
if (err) throw err
|
||||
Jimp.loadFont(Jimp.FONT_SANS_16_BLACK).then(font => {
|
||||
Jimp.loadFont(Jimp.FONT_SANS_16_BLACK).then((font) => {
|
||||
var evWidth = Jimp.measureText(font, text)
|
||||
var width = image.bitmap.width
|
||||
var height = image.bitmap.height
|
||||
|
@ -79,7 +74,7 @@ function img(mainWindow, dir) {
|
|||
e.sender.webContents.send('bmp-img-comp', [src, args[1], true])
|
||||
})
|
||||
} else {
|
||||
Jimp.loadFont(Jimp.FONT_SANS_16_WHITE).then(font => {
|
||||
Jimp.loadFont(Jimp.FONT_SANS_16_WHITE).then((font) => {
|
||||
image.print(font, left, top, args[1]).getBase64(Jimp.MIME_PNG, function (err, src) {
|
||||
e.sender.webContents.send('bmp-img-comp', [src, args[1], true])
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user