Update of 
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/popups
In directory 
james.mmbase.org:/tmp/cvs-serv18316/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/popups

Modified Files:
        insertinline_image.html 
Log Message:
CMSC-1350 - Inserting image in rich text editor returns wrong sizes into 
article: when images are small


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/popups
See also: http://www.mmbase.org/jira/browse/CMSC-1350


Index: insertinline_image.html
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/popups/insertinline_image.html,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- insertinline_image.html     13 Feb 2009 11:10:32 -0000      1.15
+++ insertinline_image.html     27 Mar 2009 11:25:50 -0000      1.16
@@ -103,21 +103,30 @@
   var imagePosition = document.getElementById("f_align").value
   if ("left" == imagePosition) {
     if (width && height) {
-     // height = (IMAGE_WIDTH_LEFT / width) * height;
+         if (width > IMAGE_WIDTH_LEFT) {
+            height = Math.round((IMAGE_WIDTH_LEFT / width) * height);
+            width = IMAGE_WIDTH_LEFT;
+         }  
       document.getElementById("f_width").value = width;
       document.getElementById("f_height").value = height;
     }
   }
   if ("right" == imagePosition) {
     if (width && height) {
-      //height = (IMAGE_WIDTH_RIGHT / width) * height;
-      document.getElementById("f_width").value = width;
-      document.getElementById("f_height").value = height;
+         if (width > IMAGE_WIDTH_RIGHT) {
+            height = Math.round((IMAGE_WIDTH_RIGHT / width) * height);
+            width = IMAGE_WIDTH_RIGHT;
+         }
+         document.getElementById("f_width").value = IMAGE_WIDTH_RIGHT;
+         document.getElementById("f_height").value = width;
     }
   }
   if ("" == imagePosition) {
     if (width && height) {
-      //height = (IMAGE_WIDTH_FULL / width) * height;
+         if (width > IMAGE_WIDTH_FULL) {
+            height = Math.round((IMAGE_WIDTH_FULL / width) * height);
+            width = IMAGE_WIDTH_FULL;
+         }
       document.getElementById("f_width").value = width;
       document.getElementById("f_height").value = height;
     }
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to