Uploading images on front end doesn’t generate thumbnail sizes

wp_generate_attachment_metadata generates metadata for an image attachment. It also creates a thumbnail and other intermediate sizes of the image attachment based on the sizes defined on the Settings_Media_Screen.

wp_generate_attachment_metadata() is located in wp-admin/includes/image.php.

/* just require image.php before wp_generate_attachment_metadata */

require_once(ABSPATH . ‘wp-admin/includes/image.php’);

$attach_data = wp_generate_attachment_metadata( $attach_id, $file );

hope that helps!