Sorry for being ignorant on these matters.
They believed it was a grand idea to post the pictures on social media.
Any picture taken by a smartphone is tagged with the date, time, and latitude/longitude coordinates where the picture was taken. If you share that in social media, that meta data is most likely sent along with the picture.
Social media already has algorithms which allow people to match faces to names. Once a use does that for several of their friends, the algorithms can learn to do it automatically.
Moreover, the installed social media apps also scan your phones data, slurping up contacts, meta data from your photos (if you allow it access to your photos, which most everyone does) and even listens for other phones nearby also running the app via Bluetooth/WiFi.
From there and other tools it’s easy to return a list of every picture from a particular geographic boundary from a certain date and time. The social media probably also has names, hometowns and phone numbers already associated. Since the apps know where you are, they can match a spouse to a common location where you spend a lot of time, or where the phone doesn’t change location during the night to get a good idea of your home address.
It is insidious how much personal data is voluntarily given up to social media and other tech companies.