z_abcd0123.jpg - name of the picture
Need check template for preg_match ()
Conditions:
where z - characters az long 1 character,
where abcd0123 is the characters af, 0-9 are 8 characters long,
jpg - characters az up to 5 characters long
Practices, of course, do not work:
preg_match("[az]{1}\_[a-f0-9]{8}\.[az]{,5}",$img)