Issue
the getFileExtension regex isn't catching the file extension from url pathname (as I expect) or loadImage should pass url.pathname to getFileExtension function.
example:
getFileExtension("https://myfile.com/") // com/
getFileExtension("https://myfile.com/file") // 'com/file'
getFileExtension("https://myfile.com/file.png?something=") // png?something=
getFileExtension("https://myfile.com/file.png?something=.webp") // "webp"