+// Methods about image preview queue.
+PlinnCKDDUploader.prototype.previewQueuePush = function(proxy) {
+ this.previewQueue.push(proxy);
+ if (!this._previewQueueRunning) {
+ this.startPreviewQueue();
+ }
+};
+
+PlinnCKDDUploader.prototype.startPreviewQueue = function() {
+ this._previewQueueRunning = true;
+ this.previewQueueLoadNext();
+};
+
+PlinnCKDDUploader.prototype.previewQueueLoadNext = function() {
+ if (this.previewQueue.length && this.previewsLoaded < MAX_PREVIEW) {
+ var proxy = this.previewQueue.shift();
+ this.previewUploadedImage(proxy);
+ this.previewsLoaded++;
+ }
+ else {
+ this._previewQueueRunning = false;
+ }
+};
+
+PlinnCKDDUploader.prototype.previewUploadedImage = function(proxy) {
+ var reader = new FileReader();
+ var size = this.thumbnailSize;
+ var self = this;
+
+ reader.onload = function(evt) {
+ proxy.img.setAttribute('src', evt.target.result);
+ // proxy.img.src = evt.target.result;
+ setTimeout(function(){self.previewQueueLoadNext();}, 500);
+ };
+ reader.readAsDataURL(proxy.file);
+};
+
+
+