wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_get_avif_info › WordPress Function
Seit6.5.0
Veraltetn/v
› wp_get_avif_info ( $filename )
Parameter: |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: |
Extracts meta information about an AVIF file: width, height, bit depth, and number of channels.
Ähnliche Funktionen: wp_get_webp_info, wp_get_nav_menus, wp_text_diff, wp_get_links, wp_get_nav_menu_object
Quellcode
function wp_get_avif_info( $filename ) { $results = array( 'width' => false, 'height' => false, 'bit_depth' => false, 'num_channels' => false, ); if ( 'image/avif' !== wp_get_image_mime( $filename ) ) { return $results; } // Parse the file using libavifinfo's PHP implementation. require_once ABSPATH . WPINC . '/class-avif-info.php'; $handle = fopen( $filename, 'rb' ); if ( $handle ) { $parser = new Avifinfo\Parser( $handle ); $success = $parser->parse_ftyp() && $parser->parse_file(); fclose( $handle ); if ( $success ) { $results = $parser->features->primary_item_features; } } return $results; }