Scale an image or data uri within the given dimensions