Title: read
Published: April 3, 2024
Last modified: April 28, 2025

---

# read( Avifinfostream $handle, int $num_bytes ): Avifinfobinary

## In this article

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

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

Reads bytes and advances the stream position by the same count.

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

 `$handle`Avifinfostreamrequired

Bytes will be read from this resource.

`$num_bytes`intrequired

Number of bytes read. Must be greater than 0.

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

 Avifinfobinary `string|false` The raw bytes or false on failure.

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

    ```php
    function read( $handle, $num_bytes ) {
      $data = fread( $handle, $num_bytes );
      return ( $data !== false && strlen( $data ) >= $num_bytes ) ? $data : false;
    }
    ```

[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#L64)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-avif-info.php#L64-L67)

## User Contributed Notes

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