WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question
You can also run it afterwards instead of on-demand: wordpress.stackexchange.com/questions/3442/… – edelwater Nov 28 '10 at 15:58
up vote 7 down vote accepted

Sure. You could hook the save_post action, use WP_Http class to download it and then insert it as an attachment using wp_insert_attachment and wp_update_attachment_metadata().

It's not trivial but shouldn't be that hard.

share|improve this answer
I've built similar systems before ... you can go further and make the plug-in automatically re-size the image for your purposes, too. There's no reason to store a 1024x600 image on the server if you're only displaying it as 256x150. – EAMann Aug 24 '10 at 1:36
Yeah, I wish I (or someone else) had time to code up a plugin for this. Maybe after I get some client work done... :) – MikeSchinkel Aug 24 '10 at 3:01

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.

share|improve this answer

There is a newer plugin in the Wordpress repository which works. Add Linked images to Gallery does not work anymore. Import External Images

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.