bbPress Plugin Browser »

Avatar Upload (0.8.3)

Download

Version: 0.8.3

Other Versions

Last Updated: 2011-7-8

Requires bbPress Version: 0.8.2 or higher

Compatible up to: 0.8.2.1

Author Homepage »

Plugin Homepage »

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(21)

Your Rating

Author: Louise Dade


  1. This plugin works fine for me on trunk, except for resizing as mentioned on page 7.

    Posted: 1 year ago #
  2. Ok so I'm looking at the avatar-upload.php and I think there's some bad programming logic there. The logic works as long as max_height and max_width settings are equal. If you are like me, and you have max_height set to a higher number than max_width, funny things start to happen.

    For example I have a setting of 150x300 as my max. When someone tries to upload an image that is 200x300 the code says "ah, the height of your image is larger! I'll base your shrinkage on the max_height!" Mathematically it's fine, but it makes the assumption that the height was the problem to begin with--which is incorrect.

    I will see if I can fix.

    Posted: 1 year ago #
  3. Ok, here's my fix--I rewrote a chunk of code so it's a diff:

    193a194,195
    >       $new_width = $img_w;
    >       $new_height = $img_h;
    195,217c197,200
    <       // if either the image width or height is greater than the maximums allowed
    <       if ($img_w > $config->max_width || $img_h > $config->max_height)
    <       {
    <               // To maintain aspect ratio we need to resize proportionally
    <
    <               if ($img_w > $img_h)
    <               {
    <                       // width is greater - make width 'max_width' and proportion height
    <                       $new_width = $config->max_width;
    <                       $new_height = round($img_h * ($config->max_width/$img_w));
    <               }
    <               else if ($img_w < $img_h)
    <               {
    <                       // height is greater - make height 'max_height' and proportion width
    <                       print $new_width = round($img_w * ($config->max_height/$img_h));
    <                       print $new_height = $config->max_height;
    <               }
    <               else
    <               {
    <                       // equal (square) - make both 'max' values
    <                       $new_width = $config->max_width;
    <                       $new_height = $config->max_height;
    <               }
    ---
    >       // If the width is too big, adjust based on width
    >       if ($new_width > $config->max_width) {
    >               $new_width = $config->max_width;
    >               $new_height = round($img_h * ($config->max_width/$img_w));
    219,222c202,206
    <       else
    <       {
    <               // image already within maximum limits - do not resize
    <               return array($img_w, $img_h);
    ---
    >
    >       // If the height is too big, adjust based on height
    >       if ($new_height > $config->max_height) {
    >               $new_width = round($img_w * ($config->max_height/$img_h));
    >               $new_height = $config->max_height;
    224a209,211
    >       // Stop here if no need to resize
    >       if ($new_width == $img_w && $new_height == $img_h) return array($img_w, $img_h);
    >
    Posted: 1 year ago #
  4. For those of you who don't like that format, go into avatar-upload.php and remove the following code from the function avatar_resize:

    // if either the image width or height is greater than the maximums allowed
            if ($img_w > $config->max_width || $img_h > $config->max_height)
            {
                    // To maintain aspect ratio we need to resize proportionally
    
                    if ($img_w > $img_h)
                    {
                            // width is greater - make width 'max_width' and proportion height
                            $new_width = $config->max_width;
                            $new_height = round($img_h * ($config->max_width/$img_w));
                    }
                    else if ($img_w < $img_h)
                    {
                            // height is greater - make height 'max_height' and proportion width
                            print $new_width = round($img_w * ($config->max_height/$img_h));
                            print $new_height = $config->max_height;
                    }
                    else
                    {
                            // equal (square) - make both 'max' values
                            $new_width = $config->max_width;
                            $new_height = $config->max_height;
                    }
            }
            else
            {
                    // image already within maximum limits - do not resize
                    return array($img_w, $img_h);
            }

    Replace the above with this:

    $new_width = $img_w;
            $new_height = $img_h;
    
            // If the width is too big, adjust based on width
            if ($new_width > $config->max_width) {
                    $new_width = $config->max_width;
                    $new_height = round($img_h * ($config->max_width/$img_w));
            }
    
            // If the height is too big, adjust based on height
            if ($new_height > $config->max_height) {
                    $new_width = round($img_w * ($config->max_height/$img_h));
                    $new_height = $config->max_height;
            }
    
            // Stop here if no need to resize
            if ($new_width == $img_w && $new_height == $img_h) return array($img_w, $img_h);
    Posted: 1 year ago #
  5. Talishmas

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Member

    As a last resort;
    My English is not very good first, In the part of the tab "Avatar" when i click the button, i only referred to the main page.I could not understand what could be the problem, maybe there's something I missed please help

    Posted: 1 year ago #
  6. Talishmas

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Member

    When I try it with Kakumei Theme;
    Fatal error: Cannot redeclare add_avatar_tab() (previously declared in /home/ismail26/public_html/forum/my-plugins/bb-avatar-upload.php:170) in /home/ismail26/public_html/forum/avatar-upload.php on line 388
    Please help!

    Posted: 1 year ago #
  7. alessandro.previti

    Member

    Thanks to the author for spending time and energies in developing such a useful plugin!

    Sadly i can't make it work!
    HEEELP! whenever i click on the "avatar" button in the profile page it just sends me back to the main page of my forum... straight!
    Why °_° how to make it to work?

    Posted: 1 year ago #
  8. Mine redirects back to the homepage as well. Not sure what's going on...

    Posted: 1 year ago #
  9. I have the same problem. When I click the avatar button it redirects me to the homepage.

    Posted: 1 year ago #
  10. gf123

    Member

    I have the same problem :(

    wp 2.9.2

    Posted: 1 year ago #
  11. newform

    Member

    same problem for me :(

    Posted: 1 year ago #
  12. HeliosPrime

    Member

    This plugin seems to no longer be working with the current version of bbPress.

    Clicking the Avatar tab, now just redirects you to the main forum page.

    Posted: 1 year ago #
  13. Does anyone know the code...and where to include the code...for using a user's "Avatar Upload" avatar as their avatar for WordPress?

    My WordPress and bbpress sites are fully integrated, I just don't know PHP so I'm not sure how to use the same avatar for both sites.

    Posted: 1 year ago #
  14. ajz

    Member

    Is there any way to show a bigger avatar on the profile page only?

    Posted: 1 year ago #
  15. cool plugin, thank you very much!

    Posted: 10 months ago #
  16. Like the plugin!

    Posted: 1 month ago #
  17. Awesome plugin but i have this problem: When I click the avatar button it redirects me to the homepage!!?

    Posted: 1 month ago #

RSS feed for this topic

Add a Comment

You must log in to post.