Description
Return the size of an attached imageWhen it's an image we return the dimensions of the original image. ie. the width and height from the deserialized array from _wp_attachment_metadata
Usage
$string = bw_fields_get_dimensions( $wp_attachment_metadata );Parameters
- $wp_attachment_metadata
- ( array ) required – attachment metadata
Returns
string Either width x height or null if width and height are not definedSource
File name: oik-fields/includes/oik-fields-virtual.phpLines:
1 to 11 of 11
function bw_fields_get_dimensions( $wp_attachment_metadata ) { //bw_trace2(); $width = bw_array_get( $wp_attachment_metadata, "width", null ); $height = bw_array_get( $wp_attachment_metadata, "height", null ); if ( $width && $height ) { $dimensions = "$width x $height"; } else { $dimensions = null; } return( $dimensions ); }View on GitHub
Called by
Invoked by
Calls
1 to 1 of 1
