Modified to support images from remote servers (cross-origin)