Latest web development tutorials

PHP imagesx (), imagesy () - Get image width and height

PHP Get image width and height

PHP Image Processing PHP Image Processing

PHP Get image width function: imagesx ()

imagesx () function is used to get the width of the image in pixels, the return value integer.

grammar:

int imagesx( resource image )

Image parameters are as imagecreatetruecolor (), imagecreatefromjpeg () function returns the image such resources.

PHP Get image height function: imagesy ()

imagesy () function is used to obtain the height of the image, grammar and usage with imagesx ().

grammar:

int imagesy( resource image )

Image parameters are as imagecreatetruecolor (), imagecreatefromjpeg () function returns the image such resources.

Examples

<?php
$img = imagecreatefrompng("w3big-logo.png");
echo "图像宽度:",imagesx( $img ),"<br />";
echo "图像高度:",imagesy( $img );
?>

Browser output:

图像宽度:290
图像高度:69

related articles

Get image information function: getimagesize ()

PHP Image Processing PHP Image Processing