I am wondering what is the correct way to check if a user provided image is an actual image.
I saw the following two examples:
$x = pathinfo('upload.png', PATHINFO_EXTENSION);
Result: png
$x = new finfo(FILEINFO_MIME_TYPE);
$x->file('upload.png');
Result: image/png