code to check if cm's photo exists