PHP JSON API to list images in a directory