diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/html/umbphotofolder.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/html/umbphotofolder.directive.js index 244893fdc1..e565660a26 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/html/umbphotofolder.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/html/umbphotofolder.directive.js @@ -14,6 +14,8 @@ angular.module("umbraco.directives.html") templateUrl: 'views/directives/html/umb-photo-folder.html', link: function(scope, element, attrs, ngModel) { + var lastWatch = null; + ngModel.$render = function() { if (ngModel.$modelValue) { @@ -37,7 +39,15 @@ angular.module("umbraco.directives.html") scope.rows = umbPhotoFolderHelper.buildGrid(photos, fixedRowWidth, maxHeight, startingIndex, minHeight, idealImgPerRow, margin); if (attrs.filterBy) { - scope.$watch(attrs.filterBy, function(newVal, oldVal) { + + //we track the watches that we create, we don't want to create multiple, so clear it + // if it already exists before creating another. + if (lastWatch) { + lastWatch(); + } + + //TODO: Need to debounce this so it doesn't filter too often! + lastWatch = scope.$watch(attrs.filterBy, function (newVal, oldVal) { if (newVal && newVal !== oldVal) { var p = $filter('filter')(photos, newVal, false); scope.baseline = 0; diff --git a/src/Umbraco.Web.UI.Client/src/common/services/util.service.js b/src/Umbraco.Web.UI.Client/src/common/services/util.service.js index 1b1f0f0c2a..243d76ef3c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/util.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/util.service.js @@ -198,7 +198,7 @@ function umbPhotoFolderHelper($compile, $log, $timeout, $filter, imageHelper, me //in this case, a single image will not fit into the row so we need to crop/center // width the full width and the min display height - if (imgs.length > 1 && imageRowHeight.imgCount === 1) { + if (imageRowHeight.imgCount === 1) { sizes.push({ width: targetWidth, //ensure that the height is rounded diff --git a/src/Umbraco.Web/Editors/ImagesController.cs b/src/Umbraco.Web/Editors/ImagesController.cs index 17221733d1..39b872af6d 100644 --- a/src/Umbraco.Web/Editors/ImagesController.cs +++ b/src/Umbraco.Web/Editors/ImagesController.cs @@ -117,7 +117,7 @@ namespace Umbraco.Web.Editors var ext = Path.GetExtension(imagePath); //we need to check if it is an image by extension - if (UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes.InvariantContains(ext) == false) + if (UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes.InvariantContains(ext.TrimStart('.')) == false) { return Request.CreateResponse(HttpStatusCode.NotFound); }