Merge pull request #51 from adam-vessey/7.x

Pass the object, to make it available to theming.
Generalize logic used to determine support for a codec in IM.