mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Fix some images not showing up
This commit is contained in:
parent
c2f2e8324c
commit
fef0cc2d71
1 changed files with 13 additions and 6 deletions
|
@ -17,13 +17,16 @@ MxcImageResponse::run()
|
|||
auto data = cache::image(fileName);
|
||||
if (!data.isNull()) {
|
||||
m_image = utils::readImage(&data);
|
||||
m_image = m_image.scaled(
|
||||
m_requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
m_image.setText("mxc url", "mxc://" + m_id);
|
||||
|
||||
if (!m_image.isNull()) {
|
||||
emit finished();
|
||||
return;
|
||||
m_image = m_image.scaled(
|
||||
m_requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
m_image.setText("mxc url", "mxc://" + m_id);
|
||||
|
||||
if (!m_image.isNull()) {
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +37,7 @@ MxcImageResponse::run()
|
|||
opts.method = "crop";
|
||||
http::client()->get_thumbnail(
|
||||
opts, [this, fileName](const std::string &res, mtx::http::RequestErr err) {
|
||||
if (err) {
|
||||
if (err || res.empty()) {
|
||||
nhlog::net()->error("Failed to download image {}",
|
||||
m_id.toStdString());
|
||||
m_error = "Failed download";
|
||||
|
@ -46,6 +49,10 @@ MxcImageResponse::run()
|
|||
auto data = QByteArray(res.data(), res.size());
|
||||
cache::saveImage(fileName, data);
|
||||
m_image = utils::readImage(&data);
|
||||
if (!m_image.isNull()) {
|
||||
m_image = m_image.scaled(
|
||||
m_requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
m_image.setText("mxc url", "mxc://" + m_id);
|
||||
|
||||
emit finished();
|
||||
|
|
Loading…
Reference in a new issue