Add unit tests for image formats and embeds template tags

I'll tidy this up, but using inheritance with mocks is a pain so it'll have to be a bit repetitive, I'm afraid.