Your child should always know that they can come to you if someone asks them something they’re not sure about.
They should come to you if anyone asks them for pictures, and unless it is a trusted person (a known, trusted method of communication with a real-life trusted person. For example: a text from grandma from her phone number) you should tell them not to send the pictures.
Occasionally, safe interactions can happen online, but the risk of it not being safe is too high, and there is no way to be sure that an online contact is safe.