We have moved to Github. Please open tickets there.

Opened 4 years ago

Closed 3 years ago

#1306 closed Enhancement (fixed)

js error in profile icon edit in internet explorer

Reported by: individuart Owned by:
Priority: high Milestone: Elgg 1.7
Component: Core Version: 1.6
Severity: major Keywords: error internet explorer solved
Cc: brettp Difficulty:

Description

There was an error in
\mod\profile\views\default\profile\editicon.php
in javascript function preview() when using internet explorer.
Sometimes you get a division by zero when calculating scaleX or scaleY
I've solved this problem modifying the function ensuring this values are greater than zero.

This is the final function preview

    function preview(img, selection) {
        if ((selection.width>0) && (selection.height>0) ){
            var origWidth = $("#user_avatar").width(); //get the width of the users master photo
            var origHeight = $("#user_avatar").height(); //get the height of the users master photo
            var scaleX = 100 / selection.width; 
            var scaleY = 100 / selection.height;
            
             
            $('#user_avatar_preview > img').css({
                width: Math.round(scaleX * origWidth) + 'px', 
                height: Math.round(scaleY * origHeight) + 'px', 
                marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', 
                marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' 
             });
        }
    } 

Many thanks

Change History (1)

comment:1 Changed 3 years ago by cash

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

Fixed in plugins commit 1139

Note: See TracTickets for help on using tickets.