Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#6479 closed defect (bug) (fixed)

jcrop aspect ratio isn't properly pulling in height/width constants from bp-custom.php

Reported by: studio625 Owned by: imath
Priority: normal Milestone: 2.3.2
Component: Media Version: 2.3.0
Severity: normal Keywords: has-patch commit
Cc:

Description

When I define a non-square aspect ratio in bp-custom.php, the jcrop interface doesn't correctly constrain the aspect ratio. If I hardcode it in, it works fine, so something is breaking down when BP hands it over to jcrop.

Here's my bp-custom code:

define ( 'BP_AVATAR_FULL_WIDTH', 328 );
define ( 'BP_AVATAR_FULL_HEIGHT', 437 );

Here's how I've been fixing it in BP < 2.3

Original Code (around line 223 of bp-core-cssjs.php:

aspectRatio: <?php echo (int) $aspect_ratio; ?>,

Modified Code:

aspectRatio: <?php echo $aspect_ratio; ?>,

(basically, don't cast it into an integer.

How I fixed it in BP 2.3
With the 2.3 release, the avatar cropping interface is different. I haven't figured out a solution other than hardcoding the aspect ratio into bp-core/js/avatar.js:

aspectRatio: 328 / 437,

Attachments (1)

6479.patch (572 bytes ) - added by imath 11 years ago.

Download all attachments as: .zip

Change History (9)

#1 @imath
11 years ago

  • Owner set to imath
  • Status newassigned

Ok thanks for your feedback i'll look at it asap.

#2 @imath
11 years ago

  • Component Component - XProfileAPI - Avatars
  • Keywords has-patch added
  • Milestone Awaiting Review2.3.2

Ok it looks like i'm building the aspect ratio the wrong way. I think 6479.patch should fix the issue.

Can you confirm @studio625 ?

@imath
11 years ago

#3 @studio625
11 years ago

  • Milestone 2.3.2
  • Resolutionworksforme
  • Status assignedclosed

Yep, that did it!

Thanks :)

#4 @imath
11 years ago

  • Keywords commit added
  • Milestone2.3.2
  • Resolution worksforme
  • Status closedreopened

Thanks for your confirmation, i'll commit the patch asap :)

#5 @imath
11 years ago

In 9920:

Avatar UI: make sure the cropper is using the correct aspect ratio.

See #6479 (branch 2.3)

Props studio625

#6 @imath
11 years ago

  • Resolutionfixed
  • Status reopenedclosed

In 9921:

Avatar UI: make sure the cropper is using the correct aspect ratio.

Fixes #6479 (trunk)

Props studio625

#7 @binh
11 years ago

I'm facing this exact problem at version 2.3.2.1. Saw the code appear exactly lik in 9921 fixed, but it's still showing height/width ratio. Maybe something deeper?

Update: I found out it's the avatar.min.js file causing the problem, not the avatar.js file.

#8 @DJPaul
10 years ago

  • Component API - AvatarsMedia
Note: See TracTickets for help on using tickets.