Is it possible to add posts and images (auto resize) for custom post types with a script?

use wp_handle_upload to upload the file, wp_insert_attachment to attach it to a post, and add post meta to the post under the key _thumbnail_id to make that attachment a featured image.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)