Skip to content

feat(theming): Only convert a background image if it benefits from it - #36471

Merged
skjnldsv merged 3 commits into
masterfrom
fix/theming-keep-images
Mar 1, 2023
Merged

feat(theming): Only convert a background image if it benefits from it#36471
skjnldsv merged 3 commits into
masterfrom
fix/theming-keep-images

Conversation

@susnux

Copy link
Copy Markdown
Contributor

Summary

  • WebP images are generally quite small, converting to pngs would increase the filesize a lot.
  • Small JPEG and PNG images do not benefit from any conversion, so skip it.
  • JPEG images will get quite bigger when converted to PNG so instead convert to progressive JPEG

This also fixes the wrong mime type sent to the browser, as before this every non gif, non svg would have been converted to a png. But the server sent the file extension as the mime type. Now the file type is preserved and only converted to the same file type.

Checklist

Comment threadapps/theming/lib/ImageManager.php Fixed
Comment threadapps/theming/lib/ImageManager.php Fixed
@szaimenszaimen added the 3. to review Waiting for reviews label Feb 1, 2023
@szaimenszaimen added this to the Nextcloud 26 milestone Feb 1, 2023
* WebP images are generally quite small, converting to pngs would increase
the filesize a lot.
* Small JPEG and PNG images do not benefit from any conversion, so skip it.
* JPEG images will get quite bigger when converted to PNG so instead convert to progressive JPEG
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
@susnux
susnuxforce-pushed the fix/theming-keep-images branch from cd51d78 to 2c28a48CompareFebruary 20, 2023 12:11

@github-advanced-securitygithub-advanced-securityAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Psalm found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
@susnux
susnuxforce-pushed the fix/theming-keep-images branch from 2c28a48 to 2ca1153CompareFebruary 20, 2023 13:57
@szaimen
szaimen requested review from a team, ArtificialOwl and icewind1991 and removed request for a teamFebruary 20, 2023 21:05
@skjnldsvskjnldsv mentioned this pull request Feb 23, 2023
@szaimen

Copy link
Copy Markdown
Contributor

@skjnldsv therr is also this attempt since you replied in #32787

@skjnldsvskjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Mar 1, 2023
@skjnldsv
skjnldsv merged commit 0b966ab into masterMar 1, 2023
@skjnldsv
skjnldsv deleted the fix/theming-keep-images branch March 1, 2023 08:54
@blizzzblizzz mentioned this pull request Mar 2, 2023
@ornanovitch

Copy link
Copy Markdown
Contributor

Hey @skjnldsv, could this be backported to 25? That would be very useful. Thanks!

@artonge

Copy link
Copy Markdown
Collaborator

/backport to stable25

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finishenhancementfeature: theming

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Uploading Theme Login Image inexplicably increases image size significantly

7 participants

@susnux@szaimen@ornanovitch@artonge@juliusknorr@skjnldsv@github-advanced-security