imagesx() 函数用于获取图像的宽度,单位为像素,返回值为整型。
int imagesx( resource image )
参数 image 为如 imagecreatetruecolor()、imagecreatefromjpeg() 等函数返回的图像资源。
imagesy() 函数用于获取图像的高度,语法及用法同 imagesx() 。
int imagesy( resource image )
参数 image 为如 imagecreatetruecolor()、imagecreatefromjpeg() 等函数返回的图像资源。
$img = imagecreatefrompng("logo.png");
echo "图像宽度:",imagesx( $img ),"<br />";
echo "图像高度:",imagesy( $img );
浏览器输出:
图像宽度:226
图像高度:154
2023-08-08 更新