getimagesize
PHP check if file is an image [duplicate]
The getimagesize() should be the most definite way of working out whether the file is an image: if(@is_array(getimagesize($mediapath))){ $image = true; } else { $image = false; } because this is a sample getimagesize() output: Array ( [0] => 800 [1] => 450 [2] => 2 [3] => width=”800″ height=”450″ [bits] => 8 [channels] => … Read more