Download:
child 85:75fb50e4e10c
parent 83:02495e40ccde
84:1084946757b4
Anton Shestakov <av6@dwimlabs.net>, Sun, 03 Apr 2016 18:35:10 +0800
contacts: optimize avatar images

3 файлов изменено, 79 вставок(+), 16 удалений(-) [+]
coffee/contacts.coffee file | annotate | diff | comparison | revisions
js/contacts.js file | annotate | diff | comparison | revisions
js/contacts.js.map file | annotate | diff | comparison | revisions
--- a/coffee/contacts.coffee Sun Apr 03 12:29:29 2016 +0800
+++ b/coffee/contacts.coffee Sun Apr 03 18:35:10 2016 +0800
@@ -1,16 +1,13 @@
class Tram.Contact extends Backbone.Model
idAttribute: 'jid'
+ optimizeSide: 96
+ optimizeThreshold: 10000
defaults:
presence: 'unavailable'
show: 'offline'
initialize: ->
- @on 'add change:avatar', ->
- avatar = @get('avatar')
- if avatar?.mime and avatar?.data
- @set('d/avatar', "data:#{ avatar.mime };base64,#{ avatar.data }")
- else
- @unset('d/avatar')
+ @on('add change:avatar', @optimizeAvatar)
@on 'add change:fullname change:nickname change:bjid', ->
@set('d/handle', @get('fullname') or @get('nickname') or @get('bjid'))
@@ -31,6 +28,38 @@
actions.push('call')
@set('d/actions', actions)
+ optimizeAvatar: ->
+ avatar = @get('avatar')
+ if not (avatar?.mime and avatar?.data)
+ return @unset('d/avatar')
+
+ data = "data:#{ avatar.mime };base64,#{ avatar.data }"
+ if data.length < @optimizeThreshold
+ return @set('d/avatar', data)
+
+ img = new Image()
+
+ img.addEventListener 'load', =>
+ if img.width < @optimizeSide and img.height < @optimizeSide
+ return @set('d/avatar', data)
+
+ ratio = Math.min(@optimizeSide / img.width, @optimizeSide / img.height)
+ canvas = document.createElement('canvas')
+ canvas.height = Math.round(img.height * ratio)
+ canvas.width = Math.round(img.width * ratio)
+ ctx = canvas.getContext('2d')
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height)
+ mime = 'image/png'
+ if avatar.mime is 'image/jpeg'
+ mime = avatar.mime
+ optimized = canvas.toDataURL(mime)
+ if img.src.length < optimized.length
+ @set('d/avatar', data)
+ else
+ @set('d/avatar', optimized)
+
+ img.src = data
+
class Tram.Contacts extends Backbone.Collection
model: Tram.Contact
--- a/js/contacts.js Sun Apr 03 12:29:29 2016 +0800
+++ b/js/contacts.js Sun Apr 03 18:35:10 2016 +0800
@@ -13,21 +13,17 @@
Contact.prototype.idAttribute = 'jid';
+ Contact.prototype.optimizeSide = 96;
+
+ Contact.prototype.optimizeThreshold = 10000;
+
Contact.prototype.defaults = {
presence: 'unavailable',
show: 'offline'
};
Contact.prototype.initialize = function() {
- this.on('add change:avatar', function() {
- var avatar;
- avatar = this.get('avatar');
- if ((avatar != null ? avatar.mime : void 0) && (avatar != null ? avatar.data : void 0)) {
- return this.set('d/avatar', "data:" + avatar.mime + ";base64," + avatar.data);
- } else {
- return this.unset('d/avatar');
- }
- });
+ this.on('add change:avatar', this.optimizeAvatar);
this.on('add change:fullname change:nickname change:bjid', function() {
return this.set('d/handle', this.get('fullname') || this.get('nickname') || this.get('bjid'));
});
@@ -59,6 +55,44 @@
});
};
+ Contact.prototype.optimizeAvatar = function() {
+ var avatar, data, img;
+ avatar = this.get('avatar');
+ if (!((avatar != null ? avatar.mime : void 0) && (avatar != null ? avatar.data : void 0))) {
+ return this.unset('d/avatar');
+ }
+ data = "data:" + avatar.mime + ";base64," + avatar.data;
+ if (data.length < this.optimizeThreshold) {
+ return this.set('d/avatar', data);
+ }
+ img = new Image();
+ img.addEventListener('load', (function(_this) {
+ return function() {
+ var canvas, ctx, mime, optimized, ratio;
+ if (img.width < _this.optimizeSide && img.height < _this.optimizeSide) {
+ return _this.set('d/avatar', data);
+ }
+ ratio = Math.min(_this.optimizeSide / img.width, _this.optimizeSide / img.height);
+ canvas = document.createElement('canvas');
+ canvas.height = Math.round(img.height * ratio);
+ canvas.width = Math.round(img.width * ratio);
+ ctx = canvas.getContext('2d');
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
+ mime = 'image/png';
+ if (avatar.mime === 'image/jpeg') {
+ mime = avatar.mime;
+ }
+ optimized = canvas.toDataURL(mime);
+ if (img.src.length < optimized.length) {
+ return _this.set('d/avatar', data);
+ } else {
+ return _this.set('d/avatar', optimized);
+ }
+ };
+ })(this));
+ return img.src = data;
+ };
+
return Contact;
})(Backbone.Model);
--- a/js/contacts.js.map Sun Apr 03 12:29:29 2016 +0800
+++ b/js/contacts.js.map Sun Apr 03 18:35:10 2016 +0800
@@ -6,5 +6,5 @@
"coffee/contacts.coffee"
],
"names": [],
- "mappings": ";AAAA;AAAA,MAAA;;;;EAAM,IAAI,CAAC;;;;;;;sBACT,WAAA,GAAa;;sBACb,QAAA,GACE;MAAA,QAAA,EAAU,aAAV;MACA,IAAA,EAAM,SADN;;;sBAGF,UAAA,GAAY,SAAA;MACV,IAAC,CAAA,EAAD,CAAI,mBAAJ,EAAyB,SAAA;AACvB,YAAA;QAAA,MAAA,GAAS,IAAC,CAAA,GAAD,CAAK,QAAL;QACT,sBAAG,MAAM,CAAE,cAAR,sBAAiB,MAAM,CAAE,cAA5B;iBACE,IAAC,CAAA,GAAD,CAAK,UAAL,EAAiB,OAAA,GAAS,MAAM,CAAC,IAAhB,GAAsB,UAAtB,GAAiC,MAAM,CAAC,IAAzD,EADF;SAAA,MAAA;iBAGE,IAAC,CAAA,KAAD,CAAO,UAAP,EAHF;;MAFuB,CAAzB;MAOA,IAAC,CAAA,EAAD,CAAI,iDAAJ,EAAuD,SAAA;eACrD,IAAC,CAAA,GAAD,CAAK,UAAL,EAAiB,IAAC,CAAA,GAAD,CAAK,UAAL,CAAA,IAAoB,IAAC,CAAA,GAAD,CAAK,UAAL,CAApB,IAAwC,IAAC,CAAA,GAAD,CAAK,MAAL,CAAzD;MADqD,CAAvD;aAGA,IAAC,CAAA,EAAD,CAAI,kDAAJ,EAAwD,SAAA;AACtD,YAAA;QAAA,IAAG,IAAC,CAAA,GAAD,CAAK,MAAL,CAAA,KAAgB,MAAnB;AAA+B,iBAAO,IAAC,CAAA,KAAD,CAAO,WAAP,EAAt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