Moving addClass('failed') as suggested in PR #1839

Extra commit in #1839 when it was rebased to dev_4_4 now needs backporting to develop.

--rebased-from #1839

Can't imagine that this needs much testing, but wouldn't hurt to check that big image viewer is still working OK.