Skip to content

[RFC] Refactor image handling - #28279

Closed
J0WI wants to merge 3 commits into
nextcloud:masterfrom
J0WI:refactor-image
Closed

[RFC] Refactor image handling#28279
J0WI wants to merge 3 commits into
nextcloud:masterfrom
J0WI:refactor-image

Conversation

@J0WI

@J0WIJ0WI commented Aug 1, 2021

Copy link
Copy Markdown
Contributor

There are various tickets about poor image handling in Nextcloud.

Nextcloud uses the OC_Image wrapper which uses GD. But GD is slow and does not support formats like SVG. That's why some modules (avatar, preview and theming app) have implemented their own image handling.

This draft aims to replace the legacy OC_Image class with a generic Image class and a set of compatible backends using GD, Imagick, Gmagick or Vips. It turned out, that the IImage interface itself does not provide all methods and not all of them are meaningful for all backends (notably the obsolete GD resource). There's also no simple way to add additional file format support.

An alternative approach would be to pull a high level image library like intervention/image or imagine/imagine.

The goal is, to provide a generic image handling that uses the fastest backend and all common and modern file types available on the host. And last but not least, to replace direct Imagick usage in avatar, preview and theming app and finally deprecate the legacy OC_Image class.

@J0WIJ0WI added the technical debt 🧱 🤔🚀 label Aug 1, 2021
@szaimenszaimen added the 2. developing Work in progress label Aug 8, 2021
@szaimenszaimen added this to the Nextcloud 23 milestone Aug 8, 2021
@skjnldsvskjnldsv mentioned this pull request Oct 13, 2021
@skjnldsvskjnldsv mentioned this pull request Mar 24, 2022
@blizzzblizzz mentioned this pull request Mar 31, 2022
This was referenced Apr 7, 2022
@blizzzblizzz modified the milestones: Nextcloud 24, Nextcloud 25Apr 21, 2022
This was referenced Aug 12, 2022
@J0WI

J0WI commented Aug 18, 2022

Copy link
Copy Markdown
ContributorAuthor

@blizzz@szaimen I've seen you listed this on beta releases, but I need some feedback on this RFC before I continue here.

@CarlSchwan

Copy link
Copy Markdown
Member

Nice work, I'll review it tomorrow

@blizzzblizzz mentioned this pull request Aug 24, 2022

@icewind1991icewind1991 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall a great step forward

Comment threadlib/private/Image/Common.php Outdated
Comment threadlib/private/Image/Common.php
Comment threadlib/private/Image/Common.php
Comment threadlib/private/Image/Gd.php Outdated
Comment threadlib/private/Image/Vips.php
Comment threadtests/lib/Image/Vips.php Outdated
@blizzzblizzz mentioned this pull request Aug 30, 2022
@J0WIJ0WI removed this from the Nextcloud 25 milestone Aug 30, 2022
@szaimenszaimen added this to the Nextcloud 26 milestone Aug 30, 2022

@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.

Found 100 potential problems in the proposed changes. Check the Files changed tab for more details.

@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.

Found 100 potential problems in the proposed changes. Check the Files changed tab for more details.

This was referenced Nov 14, 2023
@blizzzblizzz modified the milestones: Nextcloud 28, Nextcloud 29Nov 23, 2023
@J0WIJ0WI mentioned this pull request Jan 19, 2024
This was referenced Mar 12, 2024
@AltahrimAltahrim mentioned this pull request Mar 20, 2024
@skjnldsvskjnldsv removed this from the Nextcloud 31 milestone Aug 14, 2024
@sorbaugh

Copy link
Copy Markdown
Contributor

Hello @J0WI, it seems that some of the tickets you mentioned in the original comment have already been addressed so some the points have been addressed. I'm reopening this complex topic and would like to treat this as an "Overview" issue and maybe rescope it to the remaining open issues 🚀

@sorbaughsorbaugh reopened this Aug 16, 2024

@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 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@skjnldsvskjnldsv added this to the Nextcloud 32 milestone Jan 30, 2025
@skjnldsvskjnldsv added the ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) label Aug 19, 2025
@blizzzblizzz modified the milestones: Nextcloud 33, Nextcloud 34Feb 16, 2026
@susnuxsusnux added the community pull requests from community label Jun 9, 2026
@susnux

Copy link
Copy Markdown
Contributor

Hello 👋
currently here have been no activity in the last years.
If this is still actual feel free to reopen the pull request and resolve the conflicts so we can incorporate it into Nextcloud.
Thank you very much for your contribution!

@susnuxsusnux closed this Jun 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developingWork in progresscommunitypull requests from communityenhancementfeature: previews and thumbnails♻️ refactorRefactor code (not a bug fix, not a feature just refactoring)technical debt🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

11 participants

@J0WI@CarlSchwan@skjnldsv@sorbaugh@susnux@icewind1991@github-advanced-security@joshtrichards@blizzz@nextcloud-bot@szaimen