details: https://code.openbravo.com/erp/devel/pi/rev/6216b94d770b
changeset: 13314:6216b94d770b
user: David Baz Fayos <david.baz <at> openbravo.com>
date: Thu Jul 28 01:37:48 2011 +0200
summary: [imageBLOB] improved small image resize algorithm
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
| 29 ++++++---
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css
| 5 +-
2 files changed, 20 insertions(+), 14 deletions(-)
diffs (55 lines):
diff -r f2a2f86b19f2 -r 6216b94d770b
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
Wed Jul 27 23:53:38 2011 +0200
+++
b/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
@@ -200,17 +200,26 @@
command: 'GETSIZE'
};
var image = this.canvas.image;
+ var imageLayout = this.canvas.getMember(0);
OB.RemoteCallManager.call('org.openbravo.client.application.window.ImagesActionHandler',
{}, d, function(response, data, request){
- var ratio = data.width/data.height;
- if(ratio>5){
- var maxwidth = data.width>350?350:data.width;
- image.setHeight(maxwidth/ratio);
- image.setWidth(maxwidth+'px');
- }else{
- var maxheight = data.height>45?45:data.height;
- image.setHeight(maxheight+'px');
- image.setWidth(maxheight*ratio);
- }
+ var maxHeight = imageLayout.getHeight() - 12;
+ var maxWidth = imageLayout.getWidth() - 12;
+ var maxRatio = maxHeight/maxWidth;
+
+ var imgHeight = data.height;
+ var imgWidth = data.width;
+ var imgRatio = imgHeight/imgWidth;
+
+ if (imgHeight < maxHeight && imgWidth < maxWidth) {
+ image.setHeight(imgHeight);
+ image.setWidth(imgWidth);
+ } else if (imgRatio > maxRatio) {
+ image.setHeight(maxHeight);
+ image.setWidth(maxHeight/imgRatio);
+ } else {
+ image.setHeight(maxWidth*imgRatio);
+ image.setWidth(maxWidth);
+ }
});
}
this.canvas.deleteButton.updateState(newValue);
diff -r f2a2f86b19f2 -r 6216b94d770b
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css
---
a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css
Wed Jul 27 23:53:38 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css
Thu Jul 28 01:37:48 2011 +0200
@@ -126,10 +126,7 @@
.OBFormFieldNumberInputRequiredFocused,
.OBFormFieldNumberInputRequiredDisabled,
.OBFormFieldNumberInputRequiredError,
-.OBFormFieldNumberInputRequiredHint,
-
-.OBFormFieldImageInput,
-.OBFormFieldImageInputRequired {
+.OBFormFieldNumberInputRequiredHint {
font-family: arial, sans-serif;
font-size: 12px;
padding: 2px 2px 0px 2px;
------------------------------------------------------------------------------
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