The following snippet supports the article on this page titled "Import Remote Images into WordPress and Return Image URL, Image ID, and Image Dimensions". It will import a remote image into the WordPress media library, create all the relevant image sizes, and return the local image link or array of image data.
The function is for demonstration purposes only and will require modification before it can be applied in any practical way. That said, you can use it to return the image as follows:
Of course you'll also need our
beliefmedia_import_image() function. The source article provides further detail.