Skip to:
Content
Pages
Categories
Search
Top
Bottom

Avatar Cropping


  • tydd
    Participant

    @tydd

    BuddyPress Version 2.0.1
    bbPress Version 2.5.4

    site: http://www.ban-trai.com/
    id “hoangnam”
    pass “thethi0604”

    Problem: tiny pixelated avatar

    Possible cause:

    In the script below which i found in the source of the webpage where i crop avatar.

    There are 2 lines

    var fw = 150;
    var fh = 150;

    Which should be 580 as the original theme

    var fw = 580;
    var fh = 580;

    Please tell me what file to modify so it turn back to 580. Thank you!

    <script type="text/javascript">
            jQuery(window).load( function(){
                jQuery('#avatar-to-crop').Jcrop({
                    onChange: showPreview,
                    onSelect: showPreview,
                    onSelect: updateCoords,
                    aspectRatio: 1,
                    setSelect: [ 113, 113, 337, 337 ]
                });
                updateCoords({x: 113, y: 113, w: 337, h: 337});
            });
     
            function updateCoords(c) {
                jQuery('#x').val(c.x);
                jQuery('#y').val(c.y);
                jQuery('#w').val(c.w);
                jQuery('#h').val(c.h);
            }
     
            function showPreview(coords) {
                if ( parseInt(coords.w) > 0 ) {
                    var fw = 150;
                    var fh = 150;
                    var rx = fw / coords.w;
                    var ry = fh / coords.h;
     
                    jQuery( '#avatar-crop-preview' ).css({
                        width: Math.round(rx * 450) + 'px',
                        height: Math.round(ry * 450) + 'px',
                        marginLeft: '-' + Math.round(rx * coords.x) + 'px',
                        marginTop: '-' + Math.round(ry * coords.y) + 'px'
                    });
                }
            }
        </script>
Viewing 1 replies (of 1 total)

  • tydd
    Participant

    @tydd

    I resolved it by fixing wp-content/plugins/buddypress/bp-core/bp-core-avatars.php

    if ( !defined( 'BP_AVATAR_FULL_WIDTH' ) )
    		define( 'BP_AVATAR_FULL_WIDTH', 580 );
    
    if ( !defined( 'BP_AVATAR_FULL_HEIGHT' ) )
    		define( 'BP_AVATAR_FULL_HEIGHT', 580 );
Viewing 1 replies (of 1 total)
  • The topic ‘Avatar Cropping’ is closed to new replies.
Skip to toolbar