[MGNLUI-186] Thumbnail view should show icons for nodes that are not images. Created: 09/Nov/12  Updated: 11/Feb/13  Resolved: 27/Nov/12

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: None
Fix Version/s: 5.0

Type: New Feature Priority: Neutral
Reporter: Christopher Zimmermann Assignee: Christopher Zimmermann
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
is causing MGNLUI-289 ContactLinkFieldBuilder: Injection of... Closed
relation
is related to MGNLUI-213 ImageProvider should handle documents... Closed
is related to MGNLDAM-28 Assets App - Thumbnail view should sh... Closed
Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

pdf, audio, video should all serve icon images from admincentral theme.



 Comments   
Comment by Christopher Zimmermann [ 12/Nov/12 ]

Its working - but:
Currenlty using SVG files referenced from images tags. This wont work on all browsers. Need to make it work - possibly by creating png files for non-modern browsers.

Need to clean up how path is created to icons in ThumbnailContainerProperty.getValue().

Comment by Jan Haderka [ 15/Nov/12 ]

This ticket is still in-progress so up-front appology if i bring up something you wanted to do anyway but:

  • code changes committed under this ticket number were done in magnolia-ui module https://git.magnolia-cms.com/gitweb/?p=magnolia_ui.git;a=commitdiff;h=8abf4a07132691fc68df8219f2d84290130c59bc Each commit has to have ticket under it's own project number. How can one ever know what is changed in Magnolia UI or why it needs to be released if changes made to it are spread in jira projects belonging to other modules?
  • This
    } catch (Exception e) {
       log.warn("Could not get type from asset Node: {}", e.getMessage());
       return null;
    }
    

    is simply wrong. NEVER catch generic exception unless there is special use case for it. The only exceptions that the code above that is allowed to throw is RepositoryException when repo becomes unavailable in which case it is unrecoverable error and has to be logged as error. PathNotFoundException and/or ItemNotFoundException can be prevented by calling node.hasProperty("type") before attempting to retrieve it.

  • code for dealing with different media types is too rigid. I can already see bunch of image/video/audio formats that it doesn't deal with. Those formats should be added in configurable manner so it is possible to define mapping and add extra types at runtime. Magnolia has already code for dealing with mime types. Why don't we simply assign icons to different mime types as extra property and do not retrieve them via MIMEMapping?
Comment by Christopher Zimmermann [ 23/Nov/12 ]

I see the point about the MIMEMapping. But if you look at the new DefaultImageProvider.resolveIconClassName() method you can see that it is choosing icons based on the mime type, not on the extension. Which is valuable.
Possibly there should be a new configuration node in MIMEMapping module that maps from MIMEType fragments to icons - as is hardcoded currently in the method. Thoughts?

Comment by Christopher Zimmermann [ 23/Nov/12 ]

DefaultImageProvider now returns a Resource which is either an ExternalResource if its able to generate an image file, or its an IconFontResource which contains the CssClassName for the icon which is appropriate for the type of document, based on the documents MimeType.
ResourceSerializer adds an "iconfont://" uri scheme to the front of any IconFontResource items.
VThumbnail checks the type of resource which has been serialized by checking for the "iconfont://" at the front of the string, if so it builds a VIcon, otherwise it builds an image for the thumbnail.

In order to get DefaultImageProvider to create an IconFontResource it needed to be refactored and moved out of the magnolia.ui.model package where it did not belong. In model, it was renamed into ImageProviderDefinition and ConfiguredImageProviderDefinition to match the pattern of the other model classes. Where necessary other files were changed to use the ComponentProvider in order to instantiate the ImageProvider based on configuration.

ActionBar was also updated to create an Icon when the resource is an IconFontResource.

Comment by Espen Jervidalo [ 30/Nov/12 ]

Created a follow up ticket in s10.

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