Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 8 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's profile studio625 Owned by: imath's profile imath
Milestone: 2.3.2 Priority: normal
Severity: normal Version: 2.3.0
Component: Media 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 9 years ago.

Download all attachments as: .zip

Change History (9)

#1 @imath
9 years ago

  • Owner set to imath
  • Status changed from new to assigned

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

#2 @imath
9 years ago

  • Component changed from Component - XProfile to API - Avatars
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 2.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
9 years ago

#3 @studio625
9 years ago

  • Milestone 2.3.2 deleted
  • Resolution set to worksforme
  • Status changed from assigned to closed

Yep, that did it!

Thanks :)

#4 @imath
9 years ago

  • Keywords commit added
  • Milestone set to 2.3.2
  • Resolution worksforme deleted
  • Status changed from closed to reopened

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

#5 @imath
9 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
9 years ago

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

In 9921:

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

Fixes #6479 (trunk)

Props studio625

#7 @binh
9 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
8 years ago

  • Component changed from API - Avatars to Media
Note: See TracTickets for help on using tickets.