Fixed thumbnail creation for filetypes other than jpeg