What function in PHP can be used to extract the dimensions of an image file?
To extract the dimensions of an image file 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()`, you can easily retrieve the dimensions of an image file and use them in your PHP code.
$imageFile = 'image.jpg';
$imageSize = getimagesize($imageFile);
$imageWidth = $imageSize[0];
$imageHeight = $imageSize[1];
echo "Image width: $imageWidth, Image height: $imageHeight";
Related questions
-
session_start session_destroy session_regenerate_id
-
constructor PHP classes object-oriented programming
-
PHPExcel PHPSpreadsheet collaborative editing