title: How to upload and add image to WP gallery programmatically?
body: <p>I need to upload image to WP gallery from server side. So PHP script (in cron) must do the job without my interaction. So I wonder if WP has built in feature for this or should I upload image with CURL to server first and then use some WP functions to add image to post and associate it with post ?</p>