BuddyDev

Search

[Resolved] BuddyPress Signup Avatar. not correct cropping preview

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #17773

    Thank you Max.

    The problem is the aspect ratio
    It should not be zero.

    
    aspectRatio: 0,
    
    

    Is your theme defining custom height/width for avatar? I just checked the BuddyPress code in ‘bp_core_Add_cropper_inline_js’ and the ratio is calculated by this

    
    
    $aspect_ratio = $full_width / $full_height;
    
    

    It is later type casted to integer. So, if the theme defines width less than height, It gets set to zero.

    I hope it clarifies.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 95
    Maksim Rusakovich on #17774

    Thank you.

    Now I checked the Member profile page and changing the avatar, where crop ratio is working correct.

    <script type='text/javascript' src='https://dev.abodva.com/wp-includes/js/jcrop/jquery.Jcrop.min.js?ver=0.9.12'></script>

    <link rel='stylesheet' id='jcrop-css' href='https://dev.abodva.com/wp-includes/js/jcrop/jquery.Jcrop.min.css?ver=0.9.12' type='text/css' media='all' />

    Maybe it can help to understand the problem.
    Theme theme doesn’t use square avatar.

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #17775

    Hi Max,
    Even though both the section are handled by BuddyPress, Profile avatar uses different code for showing the cropper.

    If you want, you can fix it by editing buddypress/bp-core/bp-core-cssjs.php and changing oine 291 from

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

    to

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

    The bug lies in the legacy code.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 95
    Maksim Rusakovich on #17776

    Thank you.

    Could you help to write this code as snippet not to overwrite after updating?

    I use Snippet plugin for wordpress.

    Regards,
    Max

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #17779

    Hi Max,
    That’s the problem. It is hardcoded and the only way to do is to completely rewrite the whole “bp_core_add_cropper_inline_js” function. It does not seem justified for a minor change like this. I will rather open a topic on BuddyPress trac and see if they can add it as an enhancement in future version.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 95
    Maksim Rusakovich on #17780

    Thank you.
    It’s working great!

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #17781

    You are welcome.

  • Participant
    Level: Enlightened
    Posts: 53
    David Levi on #17783

    Subscribing to this thread, Im hoping to see good things come of it.

  • Participant
    Level: Enlightened
    Posts: 95
    Maksim Rusakovich on #18028

    Hello, Brajesh

    Could you, please, check the avatar and avatar previes size in mobile view?

    http://prntscr.com/l50ofn

    Now, it’s not responsive.

    Thank you.

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #18031

    Hi Max,
    I am sorry but I am not controlling the avatar size. The theme is using custom avatar size of 350×4350 and that’s why you are seeing it.

    I am unable to help with and you will need to ask the theme developer for the support.

    Regards
    Brajesh.

You must be logged in to reply to this topic.

This topic is: resolved