Well, if you have enabled iCloud on the locked iPhone before, you can try to boot your iPhone into Recovery Mode and then recover the photos from iCloud backup.
You can take the following steps to restore your iPhone and then recover your photos from iCloud backup.
Step 1: Boot your iPhone into Recovery Mode.
If your iPhone has the Home button, hold on to the Home button and the Top or Side button simultaneously until you see the Recovery screen.
If your iPhone is a Face ID model, press the Volume button and release quickly, press the Volume Down button and release quickly, and then hold on to the Top or Side button until you see the recovery mode screen.
Step 2: Connect your iPhone to your Mac and then open Finder.
Step 3: Choose your iPhone and then click Restore iPhone.
Step 4: Enter your Apple ID and passcode to confirm.
Step 5: Wait for the process to finish and then click Restore from iCloud back. Choose the latest backup.
If you have not enabled iCloud before, and you have no backup on other devices, there's no way for you to recover your photo. Maybe you can ask Apple Genius Bar for help or send your iPhone to a local professional.