Merge pull request #2879 from zapek/fix-image-jpeg-uri-mimetype

Fix image data URI
This commit is contained in:
csoler 2024-09-02 09:41:52 +02:00 committed by GitHub
commit e888e89437
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -274,7 +274,9 @@ bool ImageUtil::optimizeSizeHtml(QString &html, const QImage& original, QImage &
if(optimizeSizeBytes(bytearray, original, optimized,has_transparency?"PNG":"JPG",maxPixels, maxBytes))
{
QByteArray encodedByteArray = bytearray.toBase64();
html = "<img src=\"data:image/png;base64,";
html = "<img src=\"data:image/";
html.append(has_transparency ? "png" : "jpeg");
html.append(";base64,");
html.append(encodedByteArray);
html.append("\">");
return true;