Get image width and height with PHP

I was working on my World War II photo gallery recently. The gallery’s HTML code, particularly the main content section, looks something like the following.

Because my vertical navigation bar is on the right side of the page, if a photograph is larger than a particular width, it overlaps the vertical bar. I decided to remove the vertical bar if the photo is too large; let us assume that if the image width is larger than 580 pixels, it is too large. To apply the logic, I used the getimagesize() function. A quick example on this function is below.

I used the following PHP code to make my page work the way I want to based on width of the image.

if ($imageWidth <= 580) { ?>

Beyond width, the getimagesize() function in PHP also outputs other properties; the output is an array containing four elements. As you may have noticed, in my above example, I captured the following properties.

0 $imageWidth : Width of the image in pixels; integer.

1 $imageHeight : Height of the image in pixels; integer.

2 $imageType : Type of the image; integer. Possible values are as follows: