Skip to:
Content
Pages
Categories
Search
Top
Bottom

Avatar resize not working


  • Matt
    Participant

    @mugwumpman

    Hi, Our avatar/profile image default sizes were changed through bp-custom.php and thus give a 56:80 ratio crop when uploading new avatars. However, recently it’s reverted back to only allowing you a square crop. It was roughly around the same time we upgraded to Buddypress 2.1, has the avatar coding changed radically to make the below code out of date?

    http://independenthostels.co.uk/test/

    // Resizes avatars
    define ( 'BP_AVATAR_THUMB_WIDTH', 86 );
    define ( 'BP_AVATAR_THUMB_HEIGHT', 50 );
    define ( 'BP_AVATAR_FULL_WIDTH', 1920 );
    define ( 'BP_AVATAR_FULL_HEIGHT', 1111 );
    define ( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 2000 );
    define ( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', 819200 );
    
    // Changes default avatar
    define ( 'BP_AVATAR_DEFAULT', 'http://independenthostels.dev/wp-content/themes/ihg2014/images/avatar.jpg' );
    define ( 'BP_AVATAR_DEFAULT_THUMB', 'http://independenthostels.dev/wp-content/themes/ihg2014/images/avatar_thumb.jpg' );
    

    Many thanks, mugwumpman

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

  • Matt
    Participant

    @mugwumpman

    Update: I added
    <?php echo "Avatar size: ".bp_core_avatar_full_width()."x".bp_core_avatar_full_height()." (".bp_core_avatar_thumb_width()."x".bp_core_avatar_thumb_height()." thumb)"; ?>
    to change-avatar.php and it output “Avatar size: 1920×1111 (86×50 thumb)” next to the crop, which is still only allowing a square ratio crop. (View screenshot)

    That means it must be to do with the cropper itself then, right?


    Matt
    Participant

    @mugwumpman

    Further update: I’ve narrowed it down to the $aspect_Ratio variable in bp-core-cssjs.php on line 163 which I’ve used a hack to fix the variable for the time being.

    158	<script type="text/javascript">
    159		jQuery(window).load( function(){
    160			jQuery('#avatar-to-crop').Jcrop({
    161				onChange: showPreview,
    162				onSelect: updateCoords,
    163				aspectRatio: 1.72817, // NEW HACKED LINE WITH FIXED-RATIO
    164// ORIGINAL LINE		aspectRatio: <?php echo (int) $aspect_ratio; ?>,
    165				setSelect: [ <?php echo (int) $crop_left; ?>, <?php echo (int) $crop_top; ?>, <?php echo (int) $crop_right; ?>, <?php echo (int) $crop_bottom; ?> ]
    166			});
    167			updateCoords({x: <?php echo (int) $crop_left; ?>, y: <?php echo (int) $crop_top; ?>, w: <?php echo (int) $crop_right; ?>, h: <?php echo (int) $crop_bottom; ?>});
    168		});

    danbp
    Moderator

    @danbp

    @mugwumpman,

    you already reported around this in the past, but apparently you didn’t follow the answers. 😉

    https://buddypress.trac.wordpress.org/ticket/5182

    Open a new ticket if you cinsider there is something incorrect with cropping.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Avatar resize not working’ is closed to new replies.
Skip to toolbar