wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_image_src_get_dimensions › WordPress Function
Seit5.5.0
Veraltetn/v
› wp_image_src_get_dimensions ( $image_src, $image_meta, $attachment_id = 0 )
Parameter: (3) |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: |
Determines an image's width and height dimensions based on the source file.
Ähnliche Funktionen: image_resize_dimensions, wp_shrink_dimensions, wp_image_add_srcset_and_sizes, wp_constrain_dimensions, wp_expand_dimensions
Quellcode
function wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id = 0 ) { if ( ! wp_image_file_matches_image_meta( $image_src, $image_meta, $attachment_id ) ) { return false; } // Is it a full size image? if ( strpos( $image_src, $image_meta['file'] ) !== false ) { return array( (int) $image_meta['width'], (int) $image_meta['height'], ); } if ( ! empty( $image_meta['sizes'] ) ) { $src_filename = wp_basename( $image_src ); foreach ( $image_meta['sizes'] as $image_size_data ) { if ( $src_filename === $image_size_data['file'] ) { return array( (int) $image_size_data['width'], (int) $image_size_data['height'], ); } } } return false; }