I'm currently writing a plugin modifying the post content with the wp_insert_post_data filter. While doing that I would also like to add a post thumbnail using an external image url. It doesn't really matter if the image is hotlinked or copied to my wordpress installation. Anyone knows how to go about that?
3 Answers
you should have a look to this blog post : http://www.maverick.it/tech/create-thumbnails-using-wordpress-built-in-functions
then, if you can't use a remote image, just download it as a temporary file on your server, process and delete it.
One your image created, you should then insert it as an attachment (http://codex.wordpress.org/Function_Reference/wp_insert_attachment) and set it as the post thumbnail (http://codex.wordpress.org/Function_Reference/set_post_thumbnail)
I hope it will help.
Cyril.
This may help?
http://epicplugins.com/external-url-link-to-featured-images/
It's a plugin that lets you set your featured image from an external image URL.
Hotlinkig is inherently evil.
Just host the images on your own server. Use WordPress built-in Media Management to attach the images to your posts, and to designate them as featured images (i.e. post thumbnails).