Fix for #1636: select thumbnail format from a list instead of hard-coding to png.
Template changes to toggle behavior based on whether a thumbnail is available.