Recreated core imgbit functionality as an Angular directive.