PHP Get Image Width and Height
PHP function to get image width: imagesx()
The imagesx() function is used to get the width of an image, in pixels; the return value is an integer.
Syntax:
int imagesx( resource image )
The image parameter is the image resource returned by functions such as imagecreatetruecolor() and imagecreatefromjpeg().
PHP function to get image height: imagesy()
The imagesy() function is used to get the height of an image; its syntax and usage are the same as imagesx().
Syntax:
int imagesy( resource image )
The image parameter is the image resource returned by functions such as imagecreatetruecolor() and imagecreatefromjpeg().
Example
";
echo "图像高度:",imagesy( $img );
?>
Browser output:
图像宽度:290
图像高度:69
Related Articles
Function to get image information:getimagesize()
PHP Image Processing