Skip to content

Add thumbnails to entries in the report table

Emanuele Roberto Nocera requested to merge thumbnails into master

Created by: Zaharid

Generate thumbnails for all reports that contain png files in a 'figures' folder. Export these thumbnails to the index and display them on both tables. This should help to quickly get an idea of what an entry contains, in many common cases.

If a report contains more than 4 png images, 4 images will be selected in a deterministic way, uniformly in the alphabetized list of filenames. Otherwise the first image in alphabetic order will be used.

Thumbnails are only generated if the image is not found in its location.

One problem is that this at the moment downloads 9Mb worth of thumbnail images every time the page is loaded. Probably we should look at some lazy loading strategy. For example:

https://stackoverflow.com/questions/41075814/working-example-of-datatables-with-lazy-loading-of-images https://jsfiddle.net/Lzga6jxt/4/

I couldn't get this to work immediately, and even though I know what the problem is, I don't really want to bother anymore.

Another problem is that at the moment the thumbnails folder is inside the validphys-reports, which is not so nice. Should be in WEB and make it so that vp.nnpdf.science/thumbnails does the right thing.

The logic for selecting images can be improved in the future (e.g. could do something for images in other folders, other formats, or PDF files).

The current version can be seen at:

https://vp.nnpdf.science/

Merge request reports

Loading