What function can be used to check the size of an image in PHP?

When working with images in PHP, you may need to check the size of an image file to ensure it meets certain requirements before processing it further. To check the size of an image in PHP, you can use the `getimagesize()` function. This function returns an array containing the dimensions and MIME type of the image file.

$image_path = 'path_to_your_image.jpg';
$image_info = getimagesize($image_path);

if($image_info){
    $image_width = $image_info[0];
    $image_height = $image_info[1];
    
    echo "Image width: " . $image_width . "px<br>";
    echo "Image height: " . $image_height . "px";
} else {
    echo "Unable to get image size.";
}