diff --git a/app/js/services.js b/app/js/services.js index 60a82a06..bfbcb857 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -320,7 +320,7 @@ angular.module('myApp.services', []) } }) -.service('PhonebookContactsService', function ($q, $modal, $sce) { +.service('PhonebookContactsService', function ($q, $modal, $sce, FileManager) { var phonebookContactsPromise; @@ -376,9 +376,12 @@ angular.module('myApp.services', []) contact.phones.push(this.result.tel[i].value); } } - if (this.result.photo) { - contact.photo = URL.createObjectURL(this.result.photo[0]); - } else { + if (this.result.photo && this.result.photo[0]) { + try { + contact.photo = FileManager.getUrl(this.result.photo[0]); + } catch (e) {} + } + if (!contact.photo) { contact.photo = 'img/placeholders/UserAvatar' + ((Math.abs(count) % 8) + 1) + '@2x.png'; } contact.photo = $sce.trustAsResourceUrl(contact.photo);