Skip to content

Commit

Permalink
Merge pull request #57 from sandeepchhapola/master
Browse files Browse the repository at this point in the history
Fixed image not updating issue, #128643775
  • Loading branch information
DanielHindi authored Aug 19, 2016
2 parents 909de73 + aadc0a7 commit 2eeabdf
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions widget/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,33 @@
}
return filter;
}])*/
.directive("loadImage", ['Buildfire', function (Buildfire) {
.directive("loadImage", function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.attr("src", "../../../styles/media/holder-" + attrs.loadImage + ".gif");

var _img = attrs.finalSrc;
if (attrs.cropType == 'resize') {
Buildfire.imageLib.local.resizeImage(_img, {
width: attrs.cropWidth,
height: attrs.cropHeight
}, function (err, imgUrl) {
_img = imgUrl;
replaceImg(_img);
});
} else {
Buildfire.imageLib.local.cropImage(_img, {
width: attrs.cropWidth,
height: attrs.cropHeight
attrs.$observe('finalSrc', function() {
var _img = attrs.finalSrc;

if (attrs.cropType == 'resize') {
buildfire.imageLib.local.resizeImage(_img, {
width: attrs.cropWidth,
height: attrs.cropHeight
}, function (err, imgUrl) {
_img = imgUrl;
replaceImg(_img);
});
} else {
buildfire.imageLib.local.cropImage(_img, {
width: attrs.cropWidth,
height: attrs.cropHeight
}, function (err, imgUrl) {
_img = imgUrl;
replaceImg(_img);
_img = imgUrl;
replaceImg(_img);
});
}
}
});

function replaceImg(finalSrc) {
var elem = $("<img>");
Expand All @@ -147,5 +150,5 @@
}
}
};
}]);
});
})(window.angular, window.buildfire);

0 comments on commit 2eeabdf

Please sign in to comment.