Extracted the img replacement into a plugin

Wups!