I was wondering how can I find the width of an image using php.
As of PHP 7.1 you can do:
[0 => $width, 1 => $height, 'mime' => $mime] = getimagesize($filename);
This eliminates the need to turn $type into mime-type, while retaining the elegant array style list() assignments.
$type
list()