Fixed ugly white space while loading file thumbnail

Preview images are now pre-loaded before being set on the file element.

This fixes #5135 and prevents a white space to be displayed while the
thumbnails is being loaded.

I've tested in Chrome 30, Firefox 24 and IE8.

Please review @karlitschek @schiesbn @kabum @Kondou-ger @jancborchardt