In PHP and other programming languages, it is possible, through some special functions, to find out the size of the image.
For example:
list($width, $height) = getimagesize('images/icon.png');
I was curious to know how languages do this. Where does the image come from?
I wanted to understand how this information is read.
My question came up because when I asked this question #, I realized that in my tests, the large files took a long time to process.
But when I did the test with large and small images, to know their size, the response times were the same. So apparently the function responsible for capturing this information did not read the whole file, but returned that information from somewhere.
And what I wanted to know is where does this information come from?
How can you know, for example, the mime of an image, with such agility? I say "agility", because even if an image had 20MB, the speed of reading this information is always the same.
Where is this "information" stored? How is image size processing done?