Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 11 years ago

#1294 closed defect (bug) (wontfix)

Group Avatar Crop Tool failure

Reported by: gazouteast Owned by: jason_jm
Milestone: 1.2.6 Priority: major
Severity: Version:
Component: Groups Keywords: Group creation, Group edit, avatars, needs-patch
Cc: jason_jm, sadr, Sadr

Description

With a clean install of BP 1.1.2 onto WP 2.8.4a using all default themes etc
PHP & MySQL 5.x on CentOS 5.x shared hosting

Creating a group in BuddyPress consistently demonstrates the following -

At very first (i.e. one time only) group creation, the avatar page offers the back button and skip button - they never ever appear again during any group creation or editing any group via admin -> avatars. Checking page source, and using FireBug on FireFox, the code for those buttons is not present in the page.

But the main issue is that the javascript avatar cropper fails to load the image, trashes it to a 0Kb file, and hangs the active content of the page.

What is displayed is an 88x16 black oblong with no portion of the avatar image, the cropper handle will allow enlarge only to the 16px height of the black background, but attempting save causes a failure with "image failed to save" error.

clicking off the frame to My Groups in the second column shows the group as created without avatar, without invites, and basically, non-functional - it cannot be used for anything ... although it can be deleted and another creation attempt made, but the avatar page has neither the back or skip buttons, even when using a different group name.

Deleting the group via MySql, and the avatars (+ group folders) using cPanel file manager / FTP then allows creation of a new group ID 1, but again the back and skip buttons do not show on the avatar page, although this time the generated gravatar will display but cannot save as there is also no way to move to the next screen (invites).

Lots of BP forum threads kicking up on this one, and none of them contain a solution that has worked for me.

The number of complaints about this, and some of the esotericness of the fixes, clearly label this one as buggy code.

Change History (16)

#1 @johnjamesjacoby
12 years ago

Any updates on this? It appears to be an isolated issue.

#2 @jason_jm
12 years ago

  • Cc jason_jm added
  • Owner set to jason_jm
  • Status changed from new to assigned
  • Summary changed from BP 1.1.2 on WPMU 2.8.4a Group Avatar Crop Tool failure to Group Avatar Crop Tool failure

While I look at this can you tell me what browsers and versions this worked on just for reference while I take a look?

#3 @jason_jm
12 years ago

I can not verify your issue: "But the main issue is that the javascript avatar cropper fails to load the image, trashes it to a 0Kb file, and hangs the active content of the page."

I created a test group @:
http://testbp.org/groups/ticket1294

Using Chrome/Safari/Webkit things are working so far.

Questions

  • What was the image dimensions of the image you tried using?
  • What browser(s) are you using?

#4 @jason_jm
12 years ago

  • Priority changed from critical to minor

Flagging minor at the moment

I cannot verify and is working for me.

Awaiting additional info.

#5 @apeatling
12 years ago

This is most likely down to file system permissions and the cropper not gracefully failing under certain circumstances. For the most part the cropper works with no problem for people.

#6 @nuprn1
12 years ago

On a fresh trunk install with single WP

I noticed this problem where the step after image-upload (for croppping) was not appearing. After some digging around I noticed on bp-core-avatars.php

260 if ( getimagesize( $bp->avatar_admin->originalfile? ) > BP_AVATAR_ORIGINAL_MAX_WIDTH ) {
261 $bp->avatar_admin->resized = wp_create_thumbnail( $bp->avatar_admin->originalfile?, BP_AVATAR_ORIGINAL_MAX_WIDTH );
262 }

the getimagesize was not returning a value, and the filepath was not full

$bp->avatar_admin->originalfile? = str_replace('wp-content',,$bp->avatar_admin->originalfile?);
$bp->avatar_admin->originalfile? = WP_CONTENT_DIR . $bp->avatar_admin->originalfile?;

Resize the image down to something manageable and then delete the original
list($width, $height) = getimagesize( $bp->avatar_admin->originalfile? );

if ( $width > BP_AVATAR_ORIGINAL_MAX_WIDTH ) {

$bp->avatar_admin->resized = wp_create_thumbnail( $bp->avatar_admin->originalfile?, BP_AVATAR_ORIGINAL_MAX_WIDTH );

}

I'm able to crop but gif/png transparency is being converted to black background

#7 @nuprn1
12 years ago

... and now i see why the returning gif/png is black.

wp_crop_image returns a jpg

$dst_file = preg_replace( '/
.[
.]+$/', '.jpg', $dst_file );
if ( imagejpeg( $dst, $dst_file, apply_filters( 'jpeg_quality', 90, 'wp_crop_image' ) ) )
return $dst_file;

#8 @apeatling
12 years ago

  • Keywords needs-patch added

#9 @apeatling
12 years ago

@nuprn1 - can you submit a patch?

#11 @apeatling
12 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

I've never been able to reproduce this. There have been tweaks to avatar cropping since this was opened. I'm marking this as fixed, please reopen if you can reproduce, along with steps to reproduce.

#12 @sadr
11 years ago

  • Cc sadr added
  • Component set to Groups
  • Priority changed from minor to normal
  • Resolution fixed deleted
  • Status changed from closed to reopened

This exact issue is pestering me right now, on the jmonkeyengine.org site.

Every cropped image is a JPG. On top of that, you can't opt *not* to crop the image, even if its within the 150x150 limitation.

We can give you access to our site if requested.

#13 @Sadr
11 years ago

  • Cc Sadr added
  • Milestone changed from 1.2 to 1.2.6
  • Priority changed from normal to major

For further proof that this bug is not yet fixed, I tried to upload a transparent .png to testbp.org, and it did not go well:

http://testbp.org/groups/avatar-test/

#14 @nuprn1
11 years ago

this is a wordpress bug/issue - as buddypress uses wp_crop_image which does not check and retain the IMAGETYPE (ie, run imagegif, imagepng, imagejpeg) when resizing.

i had to hack the wp-admin/includes/image.php to include the checks

#15 @nuprn1
11 years ago

fwiw - snippet of code

list($width, $height, $orig_type) =  getimagesize( $src_file );



	// convert from full colors to index colors, like original PNG.
	if ( IMAGETYPE_PNG == $orig_type && !imageistruecolor( $dst ) )
		imagetruecolortopalette( $dst, false, imagecolorstotal( $dst ) );
		
	if ( IMAGETYPE_GIF == $orig_type ) {
		if ( !imagegif( $dst, $destfilename ) )
			return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
	} elseif ( IMAGETYPE_PNG == $orig_type ) {
		if ( !imagepng( $dst, $destfilename ) )
			return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
	} else {
		if ( !imagejpeg( $dst, $destfilename, apply_filters( 'jpeg_quality', 90, 'wp_crop_image' ) ) )
			return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
	}

#16 @johnjamesjacoby
11 years ago

  • Resolution set to wontfix
  • Status changed from reopened to closed

Thanks for the fix here nuprn1. Could you submit a patch over at the WP trac?

Note: See TracTickets for help on using tickets.