+PlinnCKDDUploader.prototype.createImageProxy = function(file) {
+ var container = new CKEDITOR.dom.element('span');
+ var rel = CKEDITOR.dom.element.createFromHtml('<span style="position:relative"/>');
+ container.append(rel);
+ var progressBar = CKEDITOR.dom.element.createFromHtml(
+ '<span style="display:block; position:absolute; background:#ef8e32; height:4px; border-radius:2px; width:0; left:0; top:1em"/>');
+ rel.append(progressBar);
+
+ var img = new CKEDITOR.dom.element('img');
+ img.setAttribute('width', 310);
+ img.setAttribute('height', 290);
+ img.setStyle('opacity', 0.2);
+ img.setAttribute('src', 'no_image.jpg');
+ img.placeholder = true;
+ var size = this.thumbnailSize;
+ var self = this;
+
+ img.on('load', function(e) {
+ if (e.sender.placeholder) {
+ e.sender.placeholder = false;
+ return;
+ };
+ var img$ = e.data.$.target;
+ if (img$.naturalWidth > img$.naturalHeight) { // landscape
+ img$.height = Math.round(size * img$.naturalHeight / img$.naturalWidth);
+ img$.width = size;
+ }
+ else {
+ img$.width = Math.round(size * img$.naturalWidth / img$.naturalHeight);
+ img$.height = size;
+ }
+ self.progressBarMaxSize = img$.width;
+ img$.style.opacity = 0.2;
+ });
+
+ container.append(img);
+
+ var proxy = {};
+ proxy.file = file;
+ proxy.type = 'image';
+ proxy.container = container;
+ proxy.progressBar = progressBar;
+ proxy.img = img;
+ return proxy;
+};
+