add VignetteRequest::setThumbnailFormat to forcefully modify an image's format potentially after the url has been generated

(cherry picked from commit 862eb9f33b88dd8f3d6421a17919a9d2f878059b)
move !empty check

(cherry picked from commit c1e63aba407b8c6013b96b7f3a2ff907dfa6d41c)
always make sure the new extension is allowed

(cherry picked from commit 6863098461b7a86e3eec5ce9563fddbcf273d3e1)
use ltrim()

(cherry picked from commit 683e8c2281504a341165d8095e8e8b1dd2be7041)
make code more readable /cc @drsnyder

(cherry picked from commit a87ffe86fe02a40d31c36cd21a4a6da25fb48716)