You will need to do a check for the image size before you add the add_image_size in that case. You can use wp_get_attachment_metadata() to find the size of the image. https://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata
You will need to do a check for the image size before you add the add_image_size in that case. You can use wp_get_attachment_metadata() to find the size of the image. https://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata