This method accepts the image path and then will return an array of information. You can extract the value directly using the "list()" method and it's as follows.
<?php list($width, $height, $type, $attr) = getimagesize("some-image.jpg");
[ 0 => 200, 1 => 120, 2 => 18, 3 => 'width="200" height="120"', 'bits' => 8, 'mime' => 'image/webp', ]
getimagesize with Laravel Storage
Do note that you can also pass in the image path from the Laravel model like below. Imagine you have a Post model that store the path of the image that's located within the storage directory.
<?php $path = storage_path('app/public/' . Post::first()->poster); list($width, $height, $type, $attr) = getimagesize($path);