I am involved in a large migration from another CMS to WordPress. We have a copy of the database and have worked out how to extract the content and programmatically create WordPress posts from it using an instantiation of the
However, there are a couple of thousand images which we would like to pull across automatically, generate the various sizes, and then attach to the posts, to save about a week's work!
Is there a way I can get an image from a remote site by URL and save it in my wp-uploads folder? I guess this uses
wp_http but I'm unfamiliar with that.
Once I've got the image and saved it I'm ok as I can then use
wp_generate_attachment_metadata to create the various sizes and
wp_insert_attachment to attach it to a post.