Q:

Setting default image size

I'm using WpeMatico plugin which saves images in the post using:
$attach_id = wp_insert_attachment( $attachment, $filename, $postid );
I looked inside wp-includes/post.php > wp_insert_attachment function, but couldn't quite figure how to resize images.  I want ALL/ANY images to have a max size of 1024 resize proportionately.  I also have the resizing function, just not sure how to use it.  
Thanks! 

A:

The original image size (i.e. 'full') is never modified.  Intermediate image sizes are controlled in various places:

Default image sizes ( 'thumbnail', 'medium', 'large' ): core settings, via Dashboard -> Settings -> Media
Custom image sizes: Theme functions.php file, via add_image_size()
Post Thumbnail size ( 'thumbnail' ): Theme functions.php file, viaset_post_thumbnail_size()`

By default, the 'large' image size is constrained to 1024px.  So, you can simply output this image size where you need a 1024px image. 
If you need to create a custom image size, you'll just need to regenerate thumbnails for existing images. 
Edit
If you need/want to constrain the size of the 'full' image size, then you'll need to modify it during the upload process, i.e. by hooking into wp_handle_upload, and performing the resize. 
There are various Plugins that accomplish this.  A quick search turns up:

Resize At Upload
Resize At Upload Plus
Resize Images Before Upload
And many more...

