Fix unrotated images in chat when picture has been taken with Exif only.

This commit is contained in:
Julien Wadel 2022-08-22 12:44:10 +02:00
parent 8f42422ee3
commit be933995f3
2 changed files with 7 additions and 6 deletions

View file

@ -112,14 +112,12 @@ QString Utils::toString(const LinphoneEnums::TunnelMode& mode){
QImage Utils::getImage(const QString &pUri) {
QImage image(pUri);
QImageReader reader(pUri);
reader.setAutoTransform(true);
if(image.isNull()){// Try to determine format from headers instead of using suffix
QImageReader reader(pUri);
reader.setDecideFormatFromContent(true);
QByteArray format = reader.format();
if(!format.isEmpty())
image = QImage(pUri, format);
}
return image;
return reader.read();
}
QString Utils::getSafeFilePath (const QString &filePath, bool *soFarSoGood) {
if (soFarSoGood)

View file

@ -78,6 +78,7 @@ Row {
property real scaleAnimatorTo : ChatStyle.entry.message.file.animation.thumbnailTo
mipmap: SettingsModel.mipmapEnabled
source: mainRow.contentModel.thumbnail
autoTransform: true
fillMode: Image.PreserveAspectFit
height: ChatStyle.entry.message.file.height
width: height*4/3
@ -85,7 +86,8 @@ Row {
anchors.fill: parent
sourceComponent: Image{// Better quality on zoom
mipmap: SettingsModel.mipmapEnabled
source:'file:/'+mainRow.contentModel.filePath
source:'image://external/'+mainRow.contentModel.filePath
autoTransform: true
fillMode: Image.PreserveAspectFit
visible: status == Image.Ready
}
@ -102,6 +104,7 @@ Row {
property real scaleAnimatorTo : ChatStyle.entry.message.file.animation.to
mipmap: SettingsModel.mipmapEnabled
source: 'file:/'+mainRow.contentModel.filePath
autoTransform: true
fillMode: Image.PreserveAspectFit
height: ChatStyle.entry.message.file.heightbetter
width: height*4/3