Hi Jerome, On Aug 23, 2011, at 6:29 PM, Jerome Velociter wrote:
Hello again,
I would like to introduce a new module in platform : xwiki-platform-thumbnails.
The idea of the module is to provide means of handling thumbnails in XWiki. Right now the main purpose is to expose APIs to retrieve thumbnails URLs for images stored as attachments. This module first use will be to generate thumbnails of user avatars. In this scenario, it will also introduce a performance improvement compared to today's way of computing avatar URLS, since the module caches both the property values (the fact that user X has set an avatar Z.png) and the thumbnail URL for this avatar.
I've already pushed it in a feature branch/. You can check in particular https://github.com/xwiki/xwiki-platform/commit/3f5aa1e24ba00fcc939b73b8f9baa... and all commits in the branch at https://github.com/xwiki/xwiki-platform/commits/feature-thumbnails
Let me know what you think.
I'm offline in the train right now so I cannot check the API you propose so my comments/questions are general: * Should this module be limited to thumbnails only or can we make it a more generic module in charge of handling image manipulations (and caching) in general (and thus including thumbnails)? I see this as replacing the old image plugin. * Re caching we should have an "active cache" working like this: - Save the location of the image as part of the cache key. When the image is a page attachment, then the location is an Entity Reference to an attachment. We could/should also handle images on the FS. - Have the cache be an EventListener listening to attachment events and have it refresh its cache when there's an attachment udpate - Save the transformation details as part of the cache key. - Save the modified images on the FS (FS cache) - that's the cache value. * We should replace all calls to the image plugin to use this new module and then move the image plugin to the legacy module. * As for caching information that user X has an avatar named Z.png I think this is not generic enough and shouldn't be in this image manipulation module. IMO it should be in a xwiki-user module in charge of handling users, and indeed that module could have a cache of user information in memory to prevent user document loading. WDYT? Thanks -Vincent