So, what I have is a Chrome extension. It scrapes a page looking for certain phrases (such as 'smile') and replaces them with an image stored locally with the same name ('smile').
The problem is, I have ~1k images that are a mixture of .gif, .jpg and .png
So I am not sure of the most efficient way to load up the image with the proper src location.
Idealy I would have it try smile.gif, smile.jpg and smile.png until it found which one is right but I don't want crazy overhead
To clarify, I already know how to detect the reference words in text -> which gives me part of the filename (for example 'smile') -> but I have no way to know at this point whether 'smile' is stored locally as a jpg/png/gif so I can't direct the <img src=....
to the exact right location.
Would it be possible to go through the directory and create some json with filename: extension, and then reference this? I am assuming I can't do this in Javascript though
Any suggestions?