Fix image URL preview, add Thumbnail.create()

- Make HMxcImage's mxc property work with http too (temporary quick
solution)

- Thumbnail objects can now be initialized with existing bytes and not
  have to download anything.
This commit is contained in:
miruka
2019-11-04 07:00:28 -04:00
parent 337603595a
commit 484eefe86d
5 changed files with 44 additions and 39 deletions

View File

@@ -2,17 +2,19 @@ import QtQuick 2.12
import "../../Base"
import "../../utils.js" as Utils
HImage {
HMxcImage {
id: image
horizontalAlignment: Image.AlignLeft
sourceSize.width: theme.chat.message.thumbnailWidth // FIXME
source: animated ? openUrl : loader.previewUrl
sourceSize.width: 640 // FIXME
sourceSize.height: 480 // FIXME
animated: loader.singleMediaInfo.media_mime === "image/gif" ||
Utils.urlExtension(loader.mediaUrl) === "gif"
clientUserId: chatPage.userId
mxc: animated ? openUrl : (loader.thumbnailMxc || loader.mediaUrl)
property EventMediaLoader loader
readonly property url openUrl: loader.mediaUrl || loader.previewUrl
readonly property url openUrl: loader.mediaUrl || loader.thumbnailMxc
TapHandler {