Title: Features::get_item_features
Published: April 3, 2024
Last modified: April 28, 2025

---

# Features::get_item_features( int $target_item_id, int $tile_depth ): AvifinfoStatus

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/avifinfo-features/get_item_features/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/avifinfo-features/get_item_features/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/avifinfo-features/get_item_features/?output_format=md#source)

[ Back to top](https://developer.wordpress.org/reference/classes/avifinfo-features/get_item_features/?output_format=md#wp--skip-link--target)

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

Binds the width, height, bit depth and number of channels from stored internal features.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/avifinfo-features/get_item_features/?output_format=md#parameters)󠁿

 `$target_item_id`intrequired

Id of the item whose features will be bound.

`$tile_depth`intrequired

Maximum recursion to search within tile-parent relations.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/avifinfo-features/get_item_features/?output_format=md#return)󠁿

 AvifinfoStatus FOUND on success or NOT_FOUND on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/avifinfo-features/get_item_features/?output_format=md#source)󠁿

    ```php
    private function get_item_features( $target_item_id, $tile_depth ) {
      foreach ( $this->props as $prop ) {
        if ( $prop->item_id != $target_item_id ) {
          continue;
        }

        // Retrieve the width and height of the primary item if not already done.
        if ( $target_item_id == $this->primary_item_id &&
             ( $this->primary_item_features['width'] == UNDEFINED ||
               $this->primary_item_features['height'] == UNDEFINED ) ) {
          foreach ( $this->dim_props as $dim_prop ) {
            if ( $dim_prop->property_index != $prop->property_index ) {
              continue;
            }
            $this->primary_item_features['width']  = $dim_prop->width;
            $this->primary_item_features['height'] = $dim_prop->height;
            if ( $this->primary_item_features['bit_depth'] != UNDEFINED &&
                 $this->primary_item_features['num_channels'] != UNDEFINED ) {
              return FOUND;
            }
            break;
          }
        }
        // Retrieve the bit depth and number of channels of the target item if not
        // already done.
        if ( $this->primary_item_features['bit_depth'] == UNDEFINED ||
             $this->primary_item_features['num_channels'] == UNDEFINED ) {
          foreach ( $this->chan_props as $chan_prop ) {
            if ( $chan_prop->property_index != $prop->property_index ) {
              continue;
            }
            $this->primary_item_features['bit_depth']    = $chan_prop->bit_depth;
            $this->primary_item_features['num_channels'] = $chan_prop->num_channels;
            if ( $this->primary_item_features['width'] != UNDEFINED &&
                $this->primary_item_features['height'] != UNDEFINED ) {
              return FOUND;
            }
            break;
          }
        }
      }

      // Check for the bit_depth and num_channels in a tile if not yet found.
      if ( $tile_depth < 3 ) {
        foreach ( $this->tiles as $tile ) {
          if ( $tile->parent_item_id != $target_item_id ) {
            continue;
          }
          $status = $this->get_item_features( $tile->tile_item_id, $tile_depth + 1 );
          if ( $status != NOT_FOUND ) {
            return $status;
          }
        }
      }
      return NOT_FOUND;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-avif-info.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-avif-info.php#L130)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-avif-info.php#L130-L185)

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Favifinfo-features%2Fget_item_features%2F)
before being able to contribute a note or feedback.