• Resolved Rodrigo

    (@rghedin)


    Hi! Glad to found this plugin.

    My server doesn’t have to much space left, so I was wondering the impact of letting users upload their avatars. I’m afraid some people could upload pictures of themselves straight from phones, which could take some mega bytes for a simple avatar image.

    Is it possible to set a maximum file size allowed for avatars uploaded?

    • This topic was modified 1 year, 5 months ago by Rodrigo. Reason: Typo
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Faisal Alvi

    (@faisal03)

    Hi @rghedin, thank you for reaching out!

    You can easily limit the maximum upload size for images on your WordPress site by using a simple filter hook. To do this, you can add the following code snippet to your theme’s functions.php file, or to a custom plugin:

    add_filter('simple_local_avatars_upload_limit', function() {
        return 1024*100; // 100 KB
    });

    This code will limit the upload size of images to 100 KB, which you can adjust by changing the number value to your desired file size limit. This will help ensure that your site’s users only upload images that are appropriately sized, which can improve site performance and reduce storage costs.

    I hope this helps!

    Thread Starter Rodrigo

    (@rghedin)

    Awesome! Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Limit image file size?’ is closed to new replies.