I just tried and it worked, you can have underscores in the url if you escape them.For instance, if your image is https://someurl.org/your_image.png,<img width="200" height="26" src="https://someurl.org/your\_image.png">will work.
This formula gives wrong results when attachments have commas in the filename, here is one that doesn’t have this issue !
IF(Attachments = BLANK(), 0, (LEN(Attachments) - LEN(SUBSTITUTE(Attachments, "https://dl.airtable.com/.attachments/", ""))) / LE...