unify handling of local and remote images