Skip to content

Commit

Permalink
Fix photo upload (#477)
Browse files Browse the repository at this point in the history
* 80px -> 100px

* Writing proper photo properly to the vcard
  • Loading branch information
DeepDiver1975 authored Aug 23, 2016
1 parent b3f9ecd commit 09ab217
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion css/public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ detailsitem.details-item-email select,
detailsitem.details-item-adr select,
detailsitem.details-item-impp select,
detailsitem.details-item-cloud select {
width: 80px;
width: 100px;
margin-right: 0;
}

Expand Down
6 changes: 5 additions & 1 deletion js/models/contact_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ angular.module('contactsApp')
// splits image data into "data:image/jpeg" and base 64 encoded image
var imageData = value.split(';base64,');
var imageType = imageData[0].slice('data:'.length);
if (!imageType.startsWith('image/')) {
return;
}
imageType = imageType.substring(6).toUpperCase();

return this.setProperty('photo', { value: imageData[1], meta: {type: [imageType]} });
return this.setProperty('photo', { value: imageData[1], meta: {type: [imageType], encoding: ['b']} });
} else {
var property = this.getProperty('photo');
if(property) {
Expand Down

0 comments on commit 09ab217

Please sign in to comment.