I have a system for a file hosting site which requires a PHP script to send out the http headers for MIME type and content length of the file.
The problem I'm facing is: would be better to store the MIME type and filesize in the database with the image's entry or to calculate it using filesize() and mime_content_type() on every hit.
I am judging 'better' based on the fastest possible load time but I would like to avoid redundant data and excessive row size if the speed increase is pointless.
Are you handling thousands, millions or billions of images?
If thousands, then store it in the database. (If you end up serving the same images a large number of times, then it should be a net saving of disk-IO)
If millions or billions, then properly measure it by profiling both solutions (AB testing) with your real traffic. There are likely too many performance variables in the rest of your code to know for sure!