What you need is probably just to use your own directory-index handler script that would output e.g. a JSON code or plain text with the data describing a list of images that the directory contains. Your web application could then use that data.
By default, you could put corresponding program code to a default index file like
index.php. If needed, directory-index file can be overridden, e.g. in the Apache web-server, with the
Without an index file, web servers either output a server-generated HTML list of all files the directory contains or a message about that directory listing is not available due to server settings.