Is there a way for me to add an <img>
tag in a Post, but then have a plugin download that image, and put it on the server for me instead of me needing to manually download the file from online to my computer and then upload it to the server?
Thanks
Sure. You could hook the
save_post
action, useWP_Http
class to download it and then insert it as an attachment usingwp_insert_attachment
andwp_update_attachment_metadata()
.It’s not trivial but shouldn’t be that hard.
There is a plugin called “Add Linked Images To Gallery” – when you insert an image to your post from an external website, this plugin automatically save a local copy and replace the link to the external site with the local address.
hope it helps.
There is a newer plugin in the WordPress repository which works. Add Linked images to Gallery does not work anymore. Import External Images