Extracted the img replacement into a plugin

Lawwwg