-
Notifications
You must be signed in to change notification settings - Fork 16

Description
Overview
In the Specify attachments interface, some thumbnails are not present in the viewer. This is because the thumbnail route is returning 404 on the web-asset-server. Downloading originals works as expected.
This is further confirmed by counting the number of images in the thumbnail directory compared to the originals directory.
- Total originals: 23591
- Total thumbnails: 5968
Possible causes
The next question is why some images are having thumbnails successfully generated while some are not.
Some server error on the asset server
It does not seem to be because of an event at a particular point in time, as additions across different days generate some thumbnails. Furthermore, the thumbnail should just be created at a later point if initially there was an error, because the check for existence is what prompts the generation.
File size
Out of 8 selected images from the GUI, all 4 that had a thumbnail were over 200MB, while all four that did not have a thumbnail were approximately 35MB.
However, this is hard to confirm en masse. Counting those over 200M does not align with the total counts in the thumbnails directory.
# Originals directory
find . -type f -size +200M -printf 1 | wc -c
681
If the threshold is relaxed to 180M, then the total overshoots. Not promising for the hypothesis, unless there is a magic number, which seems unlikely.
# Originals directory
find . -type f -size +180M -printf 1 | wc -c
6950
Mimetype
Confirmed that both those that are successful and unsuccessful are interpreted by Specify as image/tiff
(n = 8, manual)
Line 176 in 0d20ef9
assert mimetype in settings.CAN_THUMBNAIL |
ImageMagick
Originally I had thought that it would be the largest files that might fail, so the fact that the smaller images are failing is confusing. I cannot think of a reason why ImageMagick would be failing for smaller files and not larger ones.
Lines 201 to 207 in 0d20ef9
convert_args = ('-resize', "%dx%d>" % (scale, scale)) | |
if mimetype == 'application/pdf': | |
input_spec += '[0]' # only thumbnail first page of PDF | |
convert_args += ('-background', 'white', '-flatten') # add white background to PDFs | |
log("Scaling thumbnail to %d" % scale) | |
convert(input_spec, *(convert_args + (scaled_pathname,))) |