Now that I remember... I think I've seen that function before. Is it this? https://github.com/ojii/imgsize
I remember seeing something like this when I was doing a library for image loading and handling (which is still not ready for public consumption) a couple years ago...
Nevermind. I get it now. The standalone script was fixed.