Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing Avatar Cropping Ratio


  • Wythagy
    Participant

    @wythagy

    I am trying to change the dimensions/ratio of the avatar cropping tool. I am making a photography website, so it makes more since for my avatars to be the ratio of a typical photograph 2:3.

    I figured out how to change the avatar file (bp-core-avatars.php) to change the height and width of the avatars. When I change those first settings to a 2:3 ratio, the avatar cropping tool does indeed show a 2:3 ratio, however after you click “save” the image is just a skewed square in a 2:3 ratio avatar. For some reason it is still cropping it to a square on the back end, it is just outputting that square and skewing it into a 2:3 ratio box.

    So my question is, what other settings within bp-core-avatars.php do I need to change other than those settings for the avatars at the beginning of the file?

    Thanks so much for any help!

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

  • Wythagy
    Participant

    @wythagy

    I\’m assuming it is something in here that I need to change in addition to the avatar size values, I just haven\’t yet figured it out…

    // Perform v1 crop

    $v1_dest = apply_filters( ‘bp_avatar_v1_dest’, dirname($source) . ‘/’ . preg_replace(‘!(\.[^.]+)?$!’, $v1_filename . ‘$1’, basename($source), 1), $source );

    if ( $from_signup )

    $v1_out = wp_crop_image( $source, $v1_x1, $v1_y1, $v1_w, $v1_h, CORE_AVATAR_V1_W, CORE_AVATAR_V1_H, false, $v1_dest );

    else

    $v1_out = wp_crop_image( $source, ($v1_x1 * $multi), ($v1_y1 * $multi), ($v1_w * $multi), ($v1_h * $multi), CORE_AVATAR_V1_W, CORE_AVATAR_V1_H, false, $v1_dest );

    // Perform v2 crop

    if ( CORE_AVATAR_V2_W !== false && CORE_AVATAR_V2_H !== false ) {

    $v2_dest = apply_filters( ‘bp_avatar_v2_dest’, dirname($source) . ‘/’ . preg_replace(‘!(\.[^.]+)?$!’, $v2_filename . ‘$1’, basename($source), 1), $source );

    if ( $from_signup )

    $v2_out = wp_crop_image( $source, $v2_x1, $v2_y1, $v2_w, $v2_h, CORE_AVATAR_V2_W, CORE_AVATAR_V2_H, false, $v2_dest );

    else

    $v2_out = wp_crop_image( $source, ($v2_x1 * $multi), ($v2_y1 * $multi), ($v2_w * $multi), ($v2_h * $multi), CORE_AVATAR_V2_W, CORE_AVATAR_V2_H, false, $v2_dest );

    }


    Jeff Sayre
    Participant

    @jeffsayre

    Wythagy-

    I don’t have time to look into this in depth, but check out bp_core_add_cropper_js() in bp-core-cssjs.php.


    Wythagy
    Participant

    @wythagy

    Yea I looked there and it seems like it takes the variables straight from the bp-core-avatars.php script, so it doesn’t look like I can change any values per se. Like I said, what is weird is that the draggable cropper is showing up as the right rectangular 2:3 ratio shape…it’s just not saving properly (I can tell it is just saving a 1:1 ratio square and stretching it into the 2:3 ratio rectangle).


    Wythagy
    Participant

    @wythagy

    Okay weird, this time I edited the values of the height’s and width’s of the bp-core-avatars.php file and it worked fine…I give up on trying to understand these things…I’m either a little retarded or things choose to work only when they know I’ve tried everything and I’ve given up and asked someone on the forum…

    ;-)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Changing Avatar Cropping Ratio’ is closed to new replies.
Skip to toolbar