Specify7: Where and when are thumbnails generated?

For an internal project we need to determine how thumbnails are generated in the Specify system, but it proves an illusive topic. When viewing the attachments overview, we can see not all attachments have got a thumbnail generated (and this goes for jpegs not tiff, of which we know these are not generated).

It’s unclear to us:

  • When the creation of thumbnails is triggered
  • What system does this. Is it the Specify client or the web asset server?
  • Why some (jpeg) attachments are without thumbnail and how to trigger its creation

I can read on Web Asset Server / Attachment Server that the web asset server uses as dependency called ImageMagick for creating thumbnails, so it’s safe to assume that these are created there?

Upon closer inspection, thumbnails are apparently created using the sh · PyPI library in the method resolve_file() whenever a thumbnail is explicitly requested using the type=T querystring parameter and depending on whether that thumbnail has not already been generated.

Now sh seems to be some sort of wrapper around linux programs and the web asset server uses one called “convert” that does seem to be a member of the ImageMagick suite. What it basically does is save the thumbnail directly in the linux filesystem (including apparently any mounted network drives)…

Do the specify clients (Specify7 especially) play any role in thumbnail generation other than triggering the above method? Are thumbnails only generated on the fly when attempting to be viewed or also during upload.

I’m also asking, because I have added some attachment records “through the backdoor” by moving them to the storage location as well as creating corresponding entries in bulk in the Specify database…

Only when there is an attempt to view the thumbnail!

because I have added some attachment records “through the backdoor” by moving them to the storage location as well as creating corresponding entries in bulk in the Specify database

That’s fine. The attachment viewer would request a thumbnail when you open that attachment and the thumbnail would be visible