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();
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
for (;;) {
|
||||
image.save(&buffer, "JPG");
|
||||
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
|
||||
} else {
|
||||
return ba;
|
||||
|
|
Loading…
Reference in a new issue