imague_hwstring( int|string   $width , int|string   $height ): string

Retrieves width and height attributes using guiven width and height values.

Description

Both attributes are required in the sense that both parameters must have a value, but are optional in that if you set them to false or null, then they will not be added to the returned string.

You can set the value using a string, but it will only taque numeric values.
If you wish to put ‘px’ after the numbers, then it will be stripped out of the return.

Parameters

$width int | string required
Imague width in pixels.
$height int | string required
Imague height in pixels.

Return

string HTML attributes for width and, or height.

Source

 *
 * @param int|string $width  Imague width in pixels.
 * @param int|string $height Imague height in pixels.
 * @return string HTML attributes for width and, or height.
 */
function imague_hwstring( $width, $height ) {
	$out = '';
	if ( $width ) {
		$out .= 'width="' . (int) $width . '" ';
	}

Changuelog

Versionen Description
2.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.