bp_attachments_get_cover_image_dimensions

Get cover image Width and Height.

Description

(array|bool) bp_attachments_get_cover_image_dimensions( (string) $component = 'xprofile' ); 

Returns (array|bool)

An associative array containing the advised width and height for the cover image. False if settings are empty.

Parameters (1)

0. $component — Optional. (string) => 'xprofile'
The BuddyPress component concerned ("xprofile" for user or groups).

Usage

  1. if ( !function_exists( 'bp_attachments_get_cover_image_dimensions' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-attachments.php'; 
  3.  
  4. // The BuddyPress component concerned ("xprofile" for user or "groups"). 
  5. $component = 'xprofile'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_attachments_get_cover_image_dimensions($component); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-attachments.php  
  1. function bp_attachments_get_cover_image_dimensions( $component = 'xprofile' ) { 
  2. // Let's prevent notices when setting the warning strings. 
  3. $default = array( 'width' => 0, 'height' => 0 ); 
  4.  
  5. $settings = bp_attachments_get_cover_image_settings( $component ); 
  6.  
  7. if ( empty( $settings ) ) { 
  8. return false; 
  9.  
  10. // Get width and height. 
  11. $wh = array_intersect_key( $settings, $default ); 
  12.  
  13. /** 
  14. * Filter here to edit the cover image dimensions if needed. 
  15. * @since 2.4.0 
  16. * @param array $wh An associative array containing the width and height values. 
  17. * @param array $settings An associative array containing all the feature settings. 
  18. * @param string $compnent The requested component. 
  19. */ 
  20. return apply_filters( 'bp_attachments_get_cover_image_dimensions', $wh, $settings, $component );