From b9b55be035a4ac3b0141bd35cd11e7edbfc8d6dd Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Wed, 12 Nov 2014 09:05:35 +0100
Subject: [PATCH] =?UTF-8?q?bild=20gr=C3=B6ssen=20werden=20gehohle=20und=20?=
 =?UTF-8?q?gesetzt=20beim=20bild=20einf=C3=BCgen?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bin/Editor.js | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/bin/Editor.js b/bin/Editor.js
index c85560d..0fdd6a1 100644
--- a/bin/Editor.js
+++ b/bin/Editor.js
@@ -12,10 +12,12 @@ define([
     'require',
     'controls/editors/Editor',
     'Locale',
+    'Ajax',
+    'qui/utils/Math',
 
     'css!package/quiqqer/ckeditor4/bin/Editor.css'
 
-], function(require, Editor, Locale)
+], function(require, Editor, Locale, Ajax, QUIMath)
 {
     "use strict";
 
@@ -392,6 +394,15 @@ define([
 
                 var UrlInput = UrlGroup.getElement( 'input[type="text"]' );
 
+                var HeightInput = this.getContentElement('info', 'txtHeight' )
+                                      .getElement().$
+                                      .getElement( 'input[type="text"]' );
+
+                var WidthInput = this.getContentElement('info', 'txtWidth' )
+                                     .getElement().$
+                                     .getElement( 'input[type="text"]' );
+
+
                 if ( !UrlGroup.getElement( '.qui-button' ) )
                 {
                     var Button = new Element('button', {
@@ -407,6 +418,22 @@ define([
                                         onSubmit : function(Win, data)
                                         {
                                             UrlInput.value = data.url;
+
+                                            Ajax.get('ajax_media_details', function(fileData)
+                                            {
+                                                var result = QUIMath.resizeVar(
+                                                    fileData.image_height,
+                                                    fileData.image_width,
+                                                    500
+                                                );
+
+                                                HeightInput.value = result.var1;
+                                                WidthInput.value  = result.var2;
+
+                                            }, {
+                                                project : data.project,
+                                                fileid  : data.id
+                                            });
                                         }
                                     }
                                 });
@@ -557,8 +584,7 @@ define([
                 }).inject( UrlInput, 'after' );
             }
 
-
             return ev;
         }
     });
-});
\ No newline at end of file
+});
-- 
GitLab