How to change the allowed image types that users can upload to their profile

You need to use a custom code to change or limit the image file types that users can upload as their profile and cover photos.
The example code below will allow users to only upload photos with image file types .jpeg, .jpg,.jpe.