MrEugene I'm not sure the word "double" was well chosen but basically there would be 2 ways to dynamically test if a file exists:
- Try loading every image and react to any error via the
- Perform an API request to the server to ask if a specific file exists.
If we assume 50% of tags have an image, the first solution would result in N*2 requests since you would makes twice as many requests as really needed.
The second solution would result in N*3 requests since you would perform an API request for each image, and then load each valid one through a separate request. Or, in situations where many tags are displayed on the same page, it could only be N+1 if you make a single request to ask for all the images at once.
Since it's only images and doesn't involve PHP at all, the first solution might not be a performance nightmare (call every image and react to 404 errors). But that really doesn't look very clean if you can know and store in advance which tags have a picture.