_wp_get_image_size_from_meta

Advertisement

Private Access Private Access

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Summery Summery

Get the image size as array from its meta data.

Syntax Syntax

_wp_get_image_size_from_meta( string $size_name, array $image_meta )

Description Description

Used for responsive images.

Parameters Parameters

$size_name

(Required) Image size. Accepts any valid image size name ('thumbnail', 'medium', etc.).

$image_meta

(Required) The image meta data.

Return Return

(array|bool) The image meta data as returned by wp_get_attachment_metadata().

Source Source

File: wp-includes/media.php

	if ( '.' === $dirname ) {
		return '';
	}

	if ( false !== strpos( $dirname, 'wp-content/uploads' ) ) {
		// Get the directory name relative to the upload directory (back compat for pre-2.7 uploads).
		$dirname = substr( $dirname, strpos( $dirname, 'wp-content/uploads' ) + 18 );
		$dirname = ltrim( $dirname, '/' );
	}

	return $dirname;
}

/**
 * Get the image size as array from its meta data.

Advertisement

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Advertisement

Leave a Reply