How can PHP be used to determine the dimensions of an uploaded image?

To determine the dimensions of an uploaded image in PHP, you can use the getimagesize() function. This function returns an array containing the width and height of the image, as well as other information like image type and attributes. By using getimagesize() on the uploaded image file, you can easily retrieve its dimensions and use them as needed in your application.

$uploaded_image = $_FILES['image']['tmp_name'];
list($width, $height) = getimagesize($uploaded_image);
echo "Image dimensions: " . $width . "x" . $height;