Added configuration option to restrict allowed image formats. Patch by tinus.

https://github.com/tinus-github