[MGNLUI-213] ImageProvider should handle documents based on mimetypes, based on configuration Created: 23/Nov/12  Updated: 10/Mar/21  Resolved: 10/Mar/21

Status: Closed
Project: Magnolia UI
Component/s: image provider
Affects Version/s: 5.2
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Christopher Zimmermann Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-831 Consolidate code for determining medi... Closed
relation
is related to MGNLUI-186 Thumbnail view should show icons for ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 Description   

DefaultImageProvider.resolveIconClassName() returns which IconFont CssClass is appropriate for the document based on MimeType. The decision is made based on a chain of regexp comparisons on the mime type, but this set of checks should be configurable via configuration.

Related, getThumbnailResource() checks the mimetype of the doc to see if its an image, if so it generates a thumbnail image, otherwise it calls the method mentioned above to get a class name.

The above two methods should be integrated and generalized such that any type of processing can be taken on a document (probably based on mime type (not extension)) in a configurable way, to return an ExternalResource (image) or IconFontResource (cssclass).

For example, a configuration node could hold an ordered list of "MimeHandlers" which would consist of a RegExp phrase, the name of one of the default handlers (image, pdf, video, icon font), optionally a class name for a document image generator, optionally an IconFont Css class.

A concept paper should be written for this topic before implementing.


Generated at Mon Feb 12 08:34:41 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.