You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org
STL rendering is done by our custom utility called 3d2png, written in node. It shares rendering code with our client-side STL viewer. Since STL files contain 3D content, they don't define an aspect ratio for a 2D rendering of that content. This is currently hardcoded in the STL Thumbor engine, but could be easily made configurable.
Rendering STL requires xvfb and is done in a buffer specific to the current Thumbor instance, to avoid concurrent Thumbor instances on the same machine having race conditions rendering things in xvfb at the same time.
Usually, a media file type can be identified via a magic string at the beginning of the file. Unfortunately that best practice wasn't included in STL, and binary STL files cannot be identified using a magic string.
This required a special workaround for the STL engine, because for memory efficiency purposes, Thumbor only deals with the beginning of the file, to avoid loading in memory the original media in a non-streaming fashion, which can sometimes take gigabytes. As a result, STL is the only format handled by Thumbor in the Wikipedia setup where the file extension is looked at to identify binary STL files.
We look at the extension in our custom Thumbor loaders, and modify the excerpt passed to the STL engine, to make it look like a STL ASCII file. Only the excerpt is modified to "fool" the engine, the download original on disk which 3d2png will consume remains intact.