I have some images in bin, I want to check the header to check the format (jpg, png, etc)
I don't want to use temp files! I have a solution using TEMP FILES.
I can see that most of you didn't understand the question :) (question was how to validate binary data in buffer, not a file on disk).
I had same problem, and resolved it with:
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->buffer($rawImage);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With