Switch image handling to regex