fix image downscaling (#4567)
This commit is contained in:
parent
7108eb42c8
commit
217dc09c0f
1 changed files with 3 additions and 4 deletions
|
@ -74,13 +74,12 @@ QByteArray DlgEditAvatar::getImage()
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray ba;
|
|
||||||
QBuffer buffer(&ba);
|
|
||||||
buffer.open(QIODevice::WriteOnly);
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
QByteArray ba;
|
||||||
|
QBuffer buffer(&ba);
|
||||||
|
buffer.open(QIODevice::WriteOnly);
|
||||||
image.save(&buffer, "JPG");
|
image.save(&buffer, "JPG");
|
||||||
if (ba.length() > MAX_FILE_LENGTH) {
|
if (ba.length() > MAX_FILE_LENGTH) {
|
||||||
ba.clear();
|
|
||||||
image = image.scaledToWidth(image.width() / 2); // divide the amount of pixels in four to get the size down
|
image = image.scaledToWidth(image.width() / 2); // divide the amount of pixels in four to get the size down
|
||||||
} else {
|
} else {
|
||||||
return ba;
|
return ba;
|
||||||
|
|
Loading…
Reference in a new issue