函数原型
image_hwstring( int|string $width, int|string $height ): string
函数描述
Retrieves width and height attributes using given width and height values.
是否弃用
未弃用
函数参数
-
$width
int|string
Required - Image width in pixels.
-
$height
int|string
Required - Image height in pixels.
函数返回值
string HTML attributes for width and, or height.
函数位置
File: wp-includes/media.php.
函数源码
function image_hwstring( $width, $height ) {
$out = '';
if ( $width ) {
$out .= 'width="' . (int) $width . '" ';
}
if ( $height ) {
$out .= 'height="' . (int) $height . '" ';
}
return $out;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |

