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:
@@ -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 {
|
||||
|
@@ -8,7 +8,7 @@ HLoader {
|
||||
|
||||
|
||||
property QtObject singleMediaInfo
|
||||
property url mediaUrl
|
||||
property string mediaUrl
|
||||
property string showSender: ""
|
||||
property string showDate: ""
|
||||
|
||||
@@ -47,21 +47,17 @@ HLoader {
|
||||
return EventDelegate.Media.Page
|
||||
}
|
||||
|
||||
readonly property url previewUrl: (
|
||||
type === EventDelegate.Media.File ||
|
||||
type === EventDelegate.Media.Image ?
|
||||
singleMediaInfo.thumbnail_url : ""
|
||||
) || mediaUrl
|
||||
readonly property string thumbnailMxc: singleMediaInfo.thumbnail_url
|
||||
|
||||
|
||||
onPreviewUrlChanged: {
|
||||
onTypeChanged: {
|
||||
if (type === EventDelegate.Media.Image) {
|
||||
var file = "EventImage.qml"
|
||||
var file = "EventImage.qml"
|
||||
|
||||
// } else if (type === EventDelegate.Media.File) {
|
||||
// var file = "EventFile.qml"
|
||||
// var props = {
|
||||
// thumbnailUrl: previewUrl,
|
||||
// thumbnailMxc: thumbnailMxc,
|
||||
// fileUrl: mediaUrl,
|
||||
// fileTitle: info.media_title,
|
||||
// fileSize: info.media_size,
|
||||
|
Reference in New Issue
Block a user