feat: resize images and remove EXIF data - UNSAFE

This commit is contained in:
Richard Ramos 2020-07-20 16:17:05 -04:00 committed by Iuri Matias
parent a32a156651
commit 7115a1bed6
2 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import NimQml, Tables, json, sequtils, chronicles, times, re, sugar, strutils
import NimQml, Tables, json, sequtils, chronicles, times, re, sugar, strutils, os
import ../../status/status
import ../../status/accounts as status_accounts
@ -110,7 +110,9 @@ QtObject:
proc sendImage*(self: ChatsView, imagePath: string) {.slot.} =
let image = replace(imagePath, "file://", "")
self.status.chat.sendImage(self.activeChannel.id, image)
let tmpImagePath = image_resizer(image, 2000)
self.status.chat.sendImage(self.activeChannel.id, tmpImagePath)
removeFile(tmpImagePath)
proc activeChannelChanged*(self: ChatsView) {.signal.}

View File

@ -82,10 +82,11 @@ Rectangle {
visible: !isCompact
//% "No messages"
text: {
if(contentType == Constants.imageType){
return qsTr("Image");
switch(contentType){
case Constants.imageType: return qsTr("Image");
case Constants.stickerType: return qsTr("Sticker");
default: return lastMessage ? Emoji.parse(lastMessage, "26x26").replace(/\n|\r/g, ' ') : qsTrId("no-messages")
}
return lastMessage ? Emoji.parse(lastMessage, "26x26").replace(/\n|\r/g, ' ') : qsTrId("no-messages")
}
clip: true // This is needed because emojis don't ellide correctly
anchors.right: contactNumberChatsCircle.left