I have a routine that is inserting my old content into WordPress, each old post has an image associated with the post and I have them stored on the file system that I can access via POST_ID.
My question is how can I get these images in the media library?
I don't want to do this manually, so I want to use the WP API. Is there a script out there that can do this for me?
Here is what I would need the script to do:
- hand the script a post_id & file location, upload and create a thumbnail
- the image should be associated with the post in the media library