1. Home
  2. Knowledge Base
  3. Customizations
  4. PHP Functions
  5. How to Change the Default Uploaded Image Size

How to Change the Default Uploaded Image Size

Introduction

The BuddyBoss Platform sets a default size for uploaded images. You can customize this size by adding a small custom function to your active theme. This guide explains how to change the default uploaded image size.

Custom Workaround

Before proceeding, make sure you have a complete site backup.

  1. Go to Appearance > Theme Editor in your WordPress admin dashboard.
  2. Under Select theme to edit, choose your active theme (preferably a BuddyBoss Child Theme), then click Select.
  3. From the Theme Files list, open Theme Functions (functions.php).
  4. Add the following code just before the closing PHP tag (?>):
// Change the size of uploaded images
add_filter( 'bp_media_add_image_sizes', function ( $sizes ) {
    foreach ( $sizes as $size => &$custom_width ) {
        $custom_width['width'] = 500; // Update the width of image size to 500px
    }
    return $sizes;
});
  1. Click Update File to save the changes.

Note: Modifications are typically considered custom work, but we are making an exception in this case. Please review the BuddyBoss Support Policy.

Troubleshooting and FAQs

Q: The image size didn’t change after adding the code.
A: Make sure the code is added to the active theme’s functions.php file and that no caching plugin is overriding image sizes. You may need to regenerate thumbnails using a plugin like Regenerate Thumbnails.

Q: Can I change the width to a different value?
A: Yes. Replace 500 with your desired width in pixels.

Q: Will this affect previously uploaded images?
A: No. This change only applies to images uploaded after adding the code.

Q: Can I adjust the height as well?
A: BuddyBoss sets the height proportionally based on the width. If you need exact dimensions, you may need additional custom code.

Was this article helpful?

Related Articles

Subscribe to Our Newsletter

Stay In Touch

Subscribe to our Newsletter, and we’ll send you the latest news from BuddyBoss

  • This field is hidden when viewing the form
  • This field is for validation purposes and should be left unchanged.

To speak to our Agency consultant, fill in the form found at our Contact Page.

  • Get Started

    Enter your name and email address to get started with your project...

  • This field is for validation purposes and should be left unchanged.