Commit 10629efb authored by Carsten  Rose's avatar Carsten Rose
Browse files

#5023 / Fabric: Cut, rotate and enhance uploaded images - add Doc, add option 'resizeWidth'

parent 6b3df6be
......@@ -2320,8 +2320,8 @@ Fields:
|Class | enum('native', 'action', | Details below. |
| | 'container') | |
+---------------------+-----------------------------+-----------------------------------------------------------------------------------------------------+
|Type | enum('checkbox', 'date', 'time', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'editor', 'note', |
| | 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill', 'beforeLoad', 'beforeSave', |
|Type | enum('checkbox', 'date', 'time', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'editor', 'annotate', |
| | 'imageCut', 'note', 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill', 'beforeLoad', 'beforeSave', |
| | 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad', 'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete', |
| | 'sendMail') |
+---------------------+-----------------------------+-----------------------------------------------------------------------------------------------------+
......@@ -2865,6 +2865,26 @@ Type: editor
* <min_height>,<max_height>: in pixels, including top and bottom bars. E.g.: 300,600
Type: annotate
^^^^^^^^^^^^^^
TBD
Type: imageCut
^^^^^^^^^^^^^^
Uploaded images can be cut or rotate via QFQ (via fabric.js).
* The FE column name has to point to a `pathFileName` table column.
* Valid image file formats are SVG, PNG, JPG, GIF.
* Invalid or missing filenames results to an empty 'imageCut' element.
* *FormElement.parameter*::
* *resizeWidth* = <empty>|[width in pixel] - the final width of the modified image. If empty (or not given), no change.
* *keepOriginal* = <empty>|[string] - By default: '.save'. If empty (no string given), don't keep the original.
If there is already an original file, don't touch that one.
Type: note
^^^^^^^^^^
......
......@@ -2989,8 +2989,9 @@ abstract class AbstractBuildForm {
$attributeFabric .= Support::doAttribute('data-edit-image', 'true');
$attributeFabric .= Support::doAttribute('data-background-image', $imageFileName);
$attributeFabric .= Support::doAttribute('data-control-name', $htmlFabricId);
// TODO: replace by user defined content
$attributeFabric .= Support::doAttribute('data-image-resize-width', '1200');
if (!empty($formElement[FE_IMAGE_CUT_RESIZE_WIDTH]) && ctype_digit($formElement[FE_IMAGE_CUT_RESIZE_WIDTH])) {
$attributeFabric .= Support::doAttribute('data-image-resize-width', $formElement[FE_IMAGE_CUT_RESIZE_WIDTH]);
}
$attributeFabric .= Support::doAttribute('data-image-output', $htmlFabricImageId);
$attributeFabric .= $this->getAttributeFeMode($formElement[FE_MODE]);
$htmlFabric = Support::wrapTag('<div ' . $attributeFabric . ' >', '', false);
......@@ -3001,7 +3002,7 @@ abstract class AbstractBuildForm {
$attributeInput .= Support::doAttribute('type', 'hidden');
$htmlInput = Support::wrapTag('<input ' . $attributeInput . ' >', '', false);
// <img id="target-png">
// <img id="target-png"> - this element is for future use. It's not necessary for the function and is not used yet.
$attributeImage = Support::doAttribute('id', $htmlFabricImageId);
$htmlImage = Support::wrapTag('<img ' . $attributeImage . '>', '', false);
......
......@@ -950,6 +950,9 @@ const FE_SUBRECORD_TABLE_CLASS = 'subrecordTableClass';
const FE_FILE_BUTTON_TEXT = 'fileButtonText';
const FE_FILE_BUTTON_TEXT_DEFAULT = 'Choose File';
const FE_IMAGE_CUT_RESIZE_WIDTH = 'resizeWidth';
const FE_IMAGE_CUT_KEEP_ORIGINAL = 'keepOriginal';
const FE_FLAG_ROW_OPEN_TAG = '_flagRowOpenTag'; // will be automatically computed during Formload: true | false
const FE_FLAG_ROW_CLOSE_TAG = '_flagRowCloseTag'; // will be automatically computed during Formload: true | false
......
Supports Markdown
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