By the way, you can do this with almost any image. Except for more complex extensions - for image programs. Even on your PC changing the extension, it recognizes the image as another type of file. If you test change to .bmp, a very little used format, it opens the file the same on your PC. It's pretty curious how the imaging system works.
I often use
file (standard program) or
identify (part of ImageMagick) to see file details. The latter can also be used from PHP, so that's where I would start as a backend for an image host.