Support asynchronous thumbnail generation in image view helpers to avoid long loading times in media browser.
The media browser displays up to 30 thumbnails for a single view, which are generated on-the-fly blocking the view until all thumbnails have been created. This can easily result load times of over 60 seconds resulting in timeouts (blank screens) or long waiting times due to the thumbnail generation easily taking a couple of seconds per image for high resolution images. This is a terrible user experience and thus we need to improve it.
After thumbnails have been generated they rendering is much faster, but it’s a never ending problem and as soon as thumbnails have been cleared it will happen again.
A client of mine having many images is having major issues with this problem and has offered funding me to do the work.
- Remove render blocking to make the pages load in 0-2 seconds by generating thumbnails asynchronously
- Add asynchronous flag to view helpers
- Enable asynchronous flag for media browser views
- Asset service checks if thumbnail exists and has a resource
- If it exists and has a resource, the resource URI is returned
- If it exists but does not have a resource, the a asynchronous link is returned
- If it doesn’t exist, a new asynchronous thumbnail domain model is created and saved in the database, but not generated (no resource linked) and a asynchronous link is returned
- Asset service returns a URL to a thumbnailAction in ThumbnailController with the thumbnail
- thumbnailAction controller accepts thumbnail identifier as argument, generates the thumbnail and redirects to the thumbnail URI
- Generic solution can be used in other places than the media browser
- Only asynchronous if thumbnail doesn’t already exist
- Doesn’t disclose any information about the resource (only thumbnail identifier exposed)
- Cannot be used for generating random thumbnails (only thumbnail identifier exposed)
- Backwards compatible
- No rewrite rules necessary
- Is asynchronous (not generated/resource less) thumbnails allowed in the database? (data integrity)
- Can they cause any problems in other areas?
- Multiple requests will take longer and require more computing power
- Stream the image in the thumbnail controller instead of redirecting
- Generate thumbnail in a subprocess immediately (faster response in controller requests)