Respect exif rotation of images
Sometimes thumbnails still have the wrong dimensions, as they are scaled to fit inside a rectange of the reported size in the image. Not sure, who is wrong there, the media repo or we.
This commit is contained in:
parent
d94ac86816
commit
28adc9dc9b
4 changed files with 38 additions and 13 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include "Cache.h"
|
||||
#include "Logging.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "Utils.h"
|
||||
|
||||
static QPixmapCache avatar_cache;
|
||||
|
||||
|
|
@ -44,7 +45,7 @@ resolve(const QString &avatarUrl, int size, QObject *receiver, AvatarCallback ca
|
|||
|
||||
auto data = cache::image(cacheKey);
|
||||
if (!data.isNull()) {
|
||||
pixmap.loadFromData(data);
|
||||
pixmap = QPixmap::fromImage(utils::readImage(&data));
|
||||
avatar_cache.insert(cacheKey, pixmap);
|
||||
callback(pixmap);
|
||||
return;
|
||||
|
|
@ -54,9 +55,8 @@ resolve(const QString &avatarUrl, int size, QObject *receiver, AvatarCallback ca
|
|||
QObject::connect(proxy.get(),
|
||||
&AvatarProxy::avatarDownloaded,
|
||||
receiver,
|
||||
[callback, cacheKey](const QByteArray &data) {
|
||||
QPixmap pm;
|
||||
pm.loadFromData(data);
|
||||
[callback, cacheKey](QByteArray data) {
|
||||
QPixmap pm = QPixmap::fromImage(utils::readImage(&data));
|
||||
avatar_cache.insert(cacheKey, pm);
|
||||
callback(pm);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue