details:   https://code.openbravo.com/erp/devel/pi/rev/117a961fb7ec
changeset: 13315:117a961fb7ec
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Thu Jul 28 01:44:30 2011 +0200
summary:   [imageBLOB] improved small image resize algorithm - format change

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
 |  14 +++++-----
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (41 lines):

diff -r 6216b94d770b -r 117a961fb7ec 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
       Thu Jul 28 01:37:48 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
       Thu Jul 28 01:44:30 2011 +0200
@@ -191,9 +191,9 @@
   shouldSaveValue: true,
   canvasConstructor: 'OBImageCanvas',
   setValue: function(newValue){
-    if(!newValue || newValue === ''){
+    if(!newValue || newValue === '') {
       
this.canvas.setImage('../web/skins/ltr/Default/Common/Image/imageNotAvailable_medium.png');
-    }else{
+    } else {
       
this.canvas.setImage("../utility/ShowImage?id="+newValue+'&nocache='+Math.random());
       var d = {
         inpimageId: newValue,
@@ -204,20 +204,20 @@
       
OB.RemoteCallManager.call('org.openbravo.client.application.window.ImagesActionHandler',
 {}, d, function(response, data, request){
         var maxHeight = imageLayout.getHeight() - 12;
         var maxWidth = imageLayout.getWidth() - 12;
-        var maxRatio = maxHeight/maxWidth;
+        var maxRatio = maxWidth/maxHeight;
 
         var imgHeight = data.height;
         var imgWidth = data.width;
-        var imgRatio = imgHeight/imgWidth;
+        var imgRatio = imgWidth/imgHeight;
 
         if (imgHeight < maxHeight && imgWidth < maxWidth) {
           image.setHeight(imgHeight);
           image.setWidth(imgWidth);
-        } else if (imgRatio > maxRatio) {
+        } else if (imgRatio < maxRatio) {
           image.setHeight(maxHeight);
-          image.setWidth(maxHeight/imgRatio);
+          image.setWidth(maxHeight*imgRatio);
         } else {
-          image.setHeight(maxWidth*imgRatio);
+          image.setHeight(maxWidth/imgRatio);
           image.setWidth(maxWidth);
         }
       });

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to