Commit 9e8adf0f authored by Romain Courteaud's avatar Romain Courteaud

erp5_document_scanner: allow to configure the maximum width

parent ad0e9c74
...@@ -426,7 +426,7 @@ ...@@ -426,7 +426,7 @@
.push(function (result) { .push(function (result) {
orientation = result; orientation = result;
var expected_width = 2000, var expected_width = settings.maximum_width,
bitmap_options, bitmap_options,
div; div;
...@@ -434,12 +434,12 @@ ...@@ -434,12 +434,12 @@
// and size is small // and size is small
// no color correction is expected // no color correction is expected
if (((orientation < 2) || (8 < orientation)) && if (((orientation < 2) || (8 < orientation)) &&
(original_width < expected_width) && ((!expected_width) || (original_width < expected_width)) &&
(!(settings.brightness || settings.contrast || settings.enable_greyscale))) { (!(settings.brightness || settings.contrast || settings.enable_greyscale))) {
return blob; return blob;
} }
if (expected_width < original_width) { if ((!!expected_width) && (expected_width < original_width)) {
bitmap_options = { bitmap_options = {
resizeWidth: expected_width, resizeWidth: expected_width,
// resizeHeight: expected_height, // resizeHeight: expected_height,
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>982.58509.58580.23415</string> </value> <value> <string>982.58526.37480.14609</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1585659717.13</float> <float>1585660747.23</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mode</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/int</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>preferred_image_scanner_conversion_maximum_width_property</string> </value>
</item>
<item>
<key> <string>mode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>preference</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -7,6 +7,7 @@ setting_dict = { ...@@ -7,6 +7,7 @@ setting_dict = {
"enable_greyscale": preference_tool.getPreferredImageScannerConversionEnableGreyscale(), "enable_greyscale": preference_tool.getPreferredImageScannerConversionEnableGreyscale(),
"brightness": preference_tool.getPreferredImageScannerConversionBrightness(), "brightness": preference_tool.getPreferredImageScannerConversionBrightness(),
"contrast": preference_tool.getPreferredImageScannerConversionContrast(), "contrast": preference_tool.getPreferredImageScannerConversionContrast(),
"maximum_width": preference_tool.getPreferredImageScannerConversionMaximumWidth()
} }
return json.dumps(setting_dict) return json.dumps(setting_dict)
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
<key> <string>right</string> </key> <key> <string>right</string> </key>
<value> <value>
<list> <list>
<string>my_preferred_image_scanner_conversion_maximum_width</string>
<string>my_preferred_image_scanner_conversion_compression</string> <string>my_preferred_image_scanner_conversion_compression</string>
<string>my_preferred_image_scanner_conversion_brightness</string> <string>my_preferred_image_scanner_conversion_brightness</string>
<string>my_preferred_image_scanner_conversion_contrast</string> <string>my_preferred_image_scanner_conversion_contrast</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_image_scanner_conversion_maximum_width</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_integer_value</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Maximum Width</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment