Vid 1945

Lot's of refactoring for thumbnail controller and helper. 

PHP Unit tests are failing so let's not merge this till those are fixed.