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.
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/
Also add define( 'WP_DEBUG_LOG', true );
to wp-config.php
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
Did you add the _doing_it_wrong()
code I mentioned above?
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’];’
…
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' );
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.
Glad you were able to solve your problem, basvandertogt!