Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alexey 8 posts 38 karma points
    Sep 20, 2016 @ 21:58
    Alexey
    0

    Umbraco sometimes sets image width = 0 on upload

    1) The issue was detected after migration to 7.5.3, but it probably existed in 7.5.2 too, because we migrated fast.

    2) When you upload an image, using richtexteditor control, image sometimes is forced to be 0 width, like <p><img style="width: 0px; height:0px;" src="/media/17594/blindchoice.jpg?width=0&amp;height=0" alt="qweqw" rel="140606" data-id="140606" /></p>

    3) I had debugged the code and located the umbraco.directives.js file. There I had added comments to setDimensions method (line 4218).

    var setDimensions = function () {
                        console.log("setting dimensions...");
                        scope.dimensions.width = $image.width();
                        scope.dimensions.height = $image.height();
    
                        console.log("width = ", scope.dimensions.width, "height = ", scope.dimensions.height);
    
                        if(scope.center){
                            scope.dimensions.left =  scope.center.left * scope.dimensions.width -10;
                            scope.dimensions.top =  scope.center.top * scope.dimensions.height -10;
                        }else{
                            scope.center = { left: 0.5, top: 0.5 };
                        }
                    };
    

    4) I had found that this is running multiple times. Sometimes it sets the correct width and height on the last iteration and sometimes not.

    5) The images this happens with are usually very large, about 7000*3000px. The small images are usually fine.

    6) When the images are showing fine, this error could be seen in the console (after each inserting): http://prnt.sc/cke3fq. When the image width is 0 - the error is not shown.

    Any ideas why this is happening?

Please Sign in or register to post replies

Write your reply to:

Draft