What PHP function can be used to retrieve the dimensions (width and height) of an image file?
To retrieve the dimensions (width and height) of an image file in PHP, you can use the `getimagesize()` function. This function returns an array containing the image width, height, type, and attributes. By using this function, you can easily obtain the dimensions of an image file for further processing or display.
$image_path = 'path/to/your/image.jpg';
$image_dimensions = getimagesize($image_path);
$image_width = $image_dimensions[0];
$image_height = $image_dimensions[1];
echo "Image width: " . $image_width . "px<br>";
echo "Image height: " . $image_height . "px";
Related questions
-
PHP array database queries
-
PHP dynamic form database interaction
-
PHP form handling database