Commit 227f0335 authored by Igor Poboiko's avatar Igor Poboiko
Browse files

[RichTextComposerImages] Rescale QImage accordingly

The width and height are currently used to set properties of
QTextImageFormat, which then are used to set "width" and "height" html
properties for img tag, so that rescaling will be done by whoever reads
generated html. The image itself is not affected.
By also rescaling the image itself, we can save some space and reduce
the size of the document
(e.g.: I tried to add a HD photo of original size 4000x2000, whose base64
was ~12mb; I resized it to 500x250, and the size reduced to 300kb)
parent 7ebe6420
Pipeline #21758 passed with stage
in 4 minutes and 33 seconds
......@@ -81,6 +81,7 @@ void RichTextComposerImages::addImageHelper(const QUrl &url, int width, int heig
= fi.baseName().isEmpty()
? QStringLiteral("image.png")
: QString(fi.baseName() + QLatin1String(".png"));
image = image.scaled(width, height);
addImageHelper(imageName, image, width, height);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment