wppaste
WordPress

Features

Source
wp-includes/class-avif-info.php:106

Compatibility

WordPress
core
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 8

$has_primary_itempublic
$has_alphapublic
$primary_item_idpublic
$primary_item_featurespublic
$tilespublic
$propspublic
$dim_propspublic
$chan_propspublic

Methods · 2

Source code

class Features {  public $has_primary_item = false; // True if "pitm" was parsed.  public $has_alpha = false; // True if an alpha "auxC" was parsed.  public $primary_item_id;  public $primary_item_features = array( // Deduced from the data below.    'width'        => UNDEFINED, // In number of pixels.    'height'       => UNDEFINED, // Ignores crop and rotation.    'bit_depth'    => UNDEFINED, // Likely 8, 10 or 12 bits per channel per pixel.    'num_channels' => UNDEFINED  // Likely 1, 2, 3 or 4 channels:                                          //   (1 monochrome or 3 colors) + (0 or 1 alpha)  );   public $tiles = array(); // Tile[]  public $props = array(); // Prop[]  public $dim_props = array(); // Dim_Prop[]  public $chan_props = array(); // Chan_Prop[]   /**   * Binds the width, height, bit depth and number of channels from stored internal features.   *   * @param int     $target_item_id Id of the item whose features will be bound.   * @param int     $tile_depth     Maximum recursion to search within tile-parent relations.   * @return Status                 FOUND on success or NOT_FOUND on failure.   */  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;  }

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/class-avif-info.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.