I'll crawl some data from an XML file and that i have all the details I want such as the image URL.
There's a function in Wordpress known as wordpress_place_publish which is often used to produce posts programmically. To date, so great. Easy to use:
Things I likewise need is:
- Add a picture connected to the publish thumbnail by its image URL (for instance http://www.test.com/my-image.jpg)
- Re-size it on upload with Wordpress built-in functions (for instance max 300 x 300, like medium thumbnail configurations
This can be used function for your.
There's a publish relating to this here.
As well as in the theme this can be used function to get the thumb in needed size
<?php echo get_the_post_thumbnail( $id, $size, $attr ); ?>
Default thumbnail dimensions is also transformed, see this.