Skip to:
Content
Pages
Categories
Search
Top
Bottom

Avatar Upload Issue

  • Avatar of Jodyw1
    jodyw1
    Participant

    @jodyw1

    Hey guys. Just upgraded to BP 1.2. Looks great!

    I was testing out the upload of a personal avatar and I got the following message:

    “Catchable fatal error: Object of class WP_Error could not be converted to string in /var/www/doorqwpmu/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php on line 281″

    I’m trying to figure out where the problem is. Is this a permissions error? Did I encounter a bug with the new install or, since I’m using a custom theme from BuddyPress Dev, is it a problem on with their end?

    Thoughts?

Viewing 14 replies - 1 through 14 (of 14 total)
  • Avatar of Jodyw1
    jodyw1
    Participant

    @jodyw1

    Anyone?

    Avatar of tlizambri
    tlizambri
    Participant

    @tlizambri

    I am having the exact same issue. I tried various formats and sizes of images to no avail. I am using the latest WP and BP plugin and the default theme.

    Avatar of decrawford
    decrawford
    Member

    @decrawford

    Me also. I have made a completely fresh install of WP 2.9.2 & BP 1.2.2.1, and it still doesn’t work. I have tried various suggestions, including entering an absolute URL to the upload directory in Settings -> Miscellaneous, modifying bp-core-avatars.php, etc.

    I just get a blank page with “

    Catchable fatal error: Object of class WP_Error could not be converted to string in /home/fbcmi/public_html/firehouse/wpbp/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php on line 281″.

    Okay this is wild. It worked YESTERDAY. The only difference is I added in forums and I’m on Windows (I was on a Mac yesterday).

    I tried with PNG and JPG

    Avatar of willbernard
    willbernard
    Participant

    @willbernard

    Same issue here.

    Avatar of Shanni Einer
    Shanni Einer
    Participant

    @seosupportbay

    I’ve actually used this to my advantage on mine, because if it doesn’t work, and it often doesn’t, the alternative – which is always an option anyways is having members set up accounts at gravatar in order to display avatars correctly. You can disable the gravatar upload on your site on the general components set up. Just click yes to the disable gravatar uploads.

    The benefit is, that is an additional verification step to your website users to prevent against spammers. Then set your default to the ones provided in your dashboard. They don’t like that their avatar displays like that. so they go get a gravatar account so that their custom avatar displays. On some of my sites, I actually have added the option to add members gravatar accounts to their profile for cross promotional purposes. I do have a member that has gotten a gravatar and has her gravatar link listed.

    The problem is that this also prevents you from adding custom GROUP avatars. Which … I want.

    Avatar of Phlux0r
    Phlux0r
    Participant

    @phlux0r

    This happens if you try uploading images smaller than 150x150px. Try a larger image and it will work. Of course this is no excuse for the poor error handling and feedback to the user :).

    I can repro it with images 200px squared and larger.

    Oooh. Did you read where I said ‘squared’? If I upload 200px by 230px it works fine.

    I’m not sure what fluffy gay hell that was born from, but I want to kill it with fire.

    Avatar of Phlux0r
    Phlux0r
    Participant

    @phlux0r

    Looks like in BuddyPress 1.2.3 the avatar size check is not compatible with the WordPress thumbnailing function.

    If you look in bp-code/bp-core-avatars.php, function: bp_core_avatar_handle_upload()

    there is a getimagesize() call. That actually returns an array, not a single value so the if statement will not evaluate correctly and the code will always attempt to create a thumbnail. If that fails, the wp_create_thumbnail() function returns a WP_Error object, hence the message some are getting.

    here’s my modded code to fix this issue:

    /* Resize the image down to something manageable and then delete the original */
    /* HACK made some changes to check image parameters more carefully */
    $_size = getimagesize( $bp->avatar_admin->original['file'] );
    if ( $_size[0] > BP_AVATAR_ORIGINAL_MAX_WIDTH ) {
    $_thumb = wp_create_thumbnail( $bp->avatar_admin->original['file'], BP_AVATAR_ORIGINAL_MAX_WIDTH );
    // Need to check if upload succeeded - issue with small files!
    if ( is_object($_thumb) && get_class($_thumb) == 'WP_Error' ) {
    bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $_thumb->get_error_message()), 'error');
    return false;
    }
    $bp->avatar_admin->resized = $_thumb;
    }

    HTH

    Avatar of Chad Holden
    Chad Holden
    Participant

    @chadmaifithcom

    This still didn’t work for me @Phlux0r. But thanks for the code. I’ve added it to my file anyways.

    Avatar of kimjcastleberry
    KimJCastleberry
    Member

    @kimjcastleberry

    Wordpress 3.0 Beta2, BuddyPress (current, think its 1.2.3), Buddypress Links v0.4.1

    Links section, adding a new item. Trying to set the display image for the link by uploading an image. Image is 200×200 jpg.

    Catchable fatal error: Object of class WP_Error could not be converted to string in /home/satribe9/public_html/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php on line 281

    I’m guessing this is related to the same code @Phlux0r posted above, but after looking at the bp-core-avatars file, and that specific function I was uncertain exactly where in there to insert that code into the function. Could we maybe get a line number or a larger code block?

    Kimberly

    (There is also a second, probably unrelated bug with Links, when I forget to fill in the Title & Description (and it was not auto filled), when I try to submit the link and get the error that says I must fill in all fields, the Title & Description area will not re-open.)

Viewing 14 replies - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.