What function in PHP can be used to retrieve the width and height of an image?
To retrieve the width and height of an 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 this function, you can easily retrieve the dimensions of an image and use them in your PHP code.
$image = 'image.jpg';
$dimensions = getimagesize($image);
$width = $dimensions[0];
$height = $dimensions[1];
echo "Width: " . $width . "px<br>";
echo "Height: " . $height . "px";
Related Questions
- How can FTP functions in PHP be utilized to set permissions for remote files during the upload process?
- Welche Best Practices sollten bei der Verwendung von mysql_real_escape_string beachtet werden, insbesondere in Bezug auf gehashte Passwörter?
- What are the potential pitfalls of storing messages in a text file instead of a database like MySQL?