Skip to:
Content
Pages
Categories
Search
Top
Bottom

Buddypress profile photo / cover image fails


  • Bas van der Togt
    Participant

    @basvandertogt

    Hello,

    When uploading an image > 500x500px i get “HTTP ERROR”.
    All php values like upload_max_filesize and post_max_size are set high enough.

    Php error log says:
    2015/11/26 15:50:55 [error] 3940#0: *12586357 FastCGI sent in stderr: “PHP message: PHP Fatal error: Cannot use object of type WP_Error as array in /***/***/domains/***/public_html/wp-content/plugins/buddypress/bp-core/bp-core-attachments.php on line 1094” while reading response header from upstream, client: ***, server: ***, request: “POST /wp-admin/admin-ajax.php HTTP/1.1”, upstream: “fastcgi://unix:/usr/local/php55/sockets/hyper01.sock:”, host: “***”, referrer: “***/alle-gebruikers/bas/profile/change-cover-image/”

    How can i fix this?

    Using
    WP 4.3.1
    Buddypress 2.4.0

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

  • r-a-y
    Keymaster

    @r-a-y

    Thanks for the report.

    Can you do three things?

    1) Set WP_DEBUG to true in wp-config.php:
    https://codex.wordpress.org/WP_DEBUG

    2) Open up /bp-core/bp-core-attachments.php and look for the following lines:

    	// Resize the image so that it fit with the cover image dimensions
    	$cover_image  = $cover_image_class->fit( $args['file'], $dimensions );

    Right after that line, add:

    _doing_it_wrong( 'bp_attachments_cover_image_generate_file', print_r( $cover_image, true ), '2.4.0' );

    3) Go to the “Change Cover Photo” page and try reuploading a photo.

    Next, go to /wp-content/debug.log, copy the entire bp_attachments_cover_image_generate_file was called incorrectly debug message and paste it here.

    Going to ping @imath as well.


    Bas van der Togt
    Participant

    @basvandertogt

    Tnx for your reaction and sorry for the late response 🙂

    I’ve set WP_DEBUG to true and added the code as you described but there’s no debug.log created inside wp-content/


    shanebp
    Moderator

    @shanebp

    Also add define( 'WP_DEBUG_LOG', true ); to wp-config.php


    Bas van der Togt
    Participant

    @basvandertogt

    This is everything what is written to the log after i tried to upload an image:

    [02-Dec-2015 17:45:42 UTC] PHP Notice:  bp_setup_current_user was called <strong>incorrectly</strong>. The current user is being initialized without using $wp->init(). Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 1.7.) in /home/***/domains/***/public_html/wp-includes/functions.php on line 3622
    [02-Dec-2015 17:45:43 UTC] PHP Fatal error:  Cannot use object of type WP_Error as array in /home/***/domains/***/public_html/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php on line 874

    r-a-y
    Keymaster

    @r-a-y

    Did you add the _doing_it_wrong() code I mentioned above?


    Bas van der Togt
    Participant

    @basvandertogt

    Yes


    `// Make sure the file is inside the Cover Image Upload path.
    if ( false === strpos( $args[‘file’], $cover_image_class->upload_path ) ) {
    return false;
    }

    // Resize the image so that it fit with the cover image dimensions
    $cover_image = $cover_image_class->fit( $args[‘file’], $dimensions );
    _doing_it_wrong( ‘bp_attachments_cover_image_generate_file’, print_r( $cover_image, true ), ‘2.4.0’ );
    $is_too_small = false;

    // Image is too small in width and height
    if ( empty( $cover_image ) ) {
    $cover_file = $cover_image_class->generate_filename( $args[‘file’] );
    @rename( $args[‘file’], $cover_file );

    // It’s too small!
    $is_too_small = true;
    } elseif ( ! empty( $cover_image[‘path’] ) ) {
    $cover_file = $cover_image[‘path’];’


    Bas van der Togt
    Participant

    @basvandertogt

    Somebody?


    r-a-y
    Keymaster

    @r-a-y

    Sorry @basvandertogt.

    Can you add the debug line around line 1092?

    It should resemble this:

    
    	if ( ! is_a( $cover_image_class, 'BP_Attachment_Cover_Image' ) ) {
    		$cover_image_class = new BP_Attachment_Cover_Image();
    	}
    
    	// Here's the addition
    	_doing_it_wrong( 'bp_attachments_cover_image_generate_file', print_r( $cover_image_class, true ), '2.4.0' );

    Bas van der Togt
    Participant

    @basvandertogt

    I found the problem myself already. After some dedugging i found this error on the console:

    Wrong JPEG library version: library is 62, caller expects 80 /home/***/domains/***/public_html/wp-content/uploads/avatars/22/Burning_Man_2009_Art_Gimbel_Surfing8.jpg' @ error/jpeg.c/JPEGErrorHandler/316

    After i updated the jpeg library everything worked.


    r-a-y
    Keymaster

    @r-a-y

    Glad you were able to solve your problem, basvandertogt!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Buddypress profile photo / cover image fails’ is closed to new replies.
Skip to toolbar