wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



_wp_get_image_size_from_meta › WordPress Function

Seit4.4.0
Veraltetn/v
_wp_get_image_size_from_meta ( $size_name, $image_meta )
Zugriff:
  • private
Parameter: (2)
  • (string) $size_name Image size. Accepts any registered image size name.
    Erforderlich: Ja
  • (array) $image_meta The image meta data.
    Erforderlich: Ja
Gibt zurück:
  • (array|false) { Array of width and height or false if the size isn't present in the meta data. @type int $0 Image width. @type int $1 Image height. }
Definiert in:
Codex:

Gets the image size as array from its meta data.

Used for responsive images.


Quellcode

function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
	if ( 'full' === $size_name ) {
		return array(
			absint( $image_meta['width'] ),
			absint( $image_meta['height'] ),
		);
	} elseif ( ! empty( $image_meta['sizes'][ $size_name ] ) ) {
		return array(
			absint( $image_meta['sizes'][ $size_name ]['width'] ),
			absint( $image_meta['sizes'][ $size_name ]['height'] ),
		);
	}

	return false;
}