The imagesx() function is used to obtain the width of the image, in pixels, and the return value is an integer.
int imagesx(resource image)
The parameter image is the image resource returned by functions such as imagecreatetruecolor(), imagecreatefromjpeg(), etc.
The imagesy() function is used to obtain the height of an image. The syntax and usage are the same as imagesx().
int imagesy(resource image)
The parameter image is the image resource returned by functions such as imagecreatetruecolor(), imagecreatefromjpeg(), etc.
<?php$img = imagecreatefrompng("codercto-logo.png");echo "Image width:",imagesx( $img),"<br />";echo "Image height:",imagesy( $img); ?>
Browser output:
Image width: 290 Image height: 69
Get image information function: getimagesize()