Commit 19dcea25 authored by Carsten  Rose's avatar Carsten Rose
Browse files

#5023 / Fabric: Cut, rotate and enhance uploaded images

AbstractBuildForm.php: change 'annotate' and 'imageCut' to use SIP encoded download.
parent 0fad8e0e
......@@ -2919,9 +2919,10 @@ abstract class AbstractBuildForm {
}
}
$attributeImage = Support::doAttribute('id', 'qfq-fabric-image-1');
$attributeImage .= Support::doAttribute('src', $formElement[FE_IMAGE_SOURCE]);
// $attributeImage .= Support::doAttribute('src', $formElement[FE_IMAGE_SOURCE]);
$attributeImage .= Support::doAttribute('src', $this->fileToSipUrl($formElement[FE_IMAGE_SOURCE]));
$attributeImage .= Support::doAttribute('class', 'qfq-fabric-image');
$htmlImage = Support::wrapTag('<img ' . $attributeImage . '>', '', false);
......@@ -2978,9 +2979,7 @@ abstract class AbstractBuildForm {
$htmlFabricId = $formElement[FE_HTML_ID];
$htmlFabricImageId = $formElement[FE_HTML_ID] . '-image';
//TODO: replace 'filename' by download via SIP
$imageFileName = support::joinPath($this->store->getVar(SYSTEM_BASE_URL_PRINT, STORE_SYSTEM), $value, PATH_FILE_CONCAT);
$imageFileName = $value;
$imageFileName = $this->fileToSipUrl($value);
// <div class="fabric"
// data-buttons="mockData/fabric.editor.buttons.json"
......@@ -3024,6 +3023,20 @@ abstract class AbstractBuildForm {
return $html;
}
/**
* @param string $pathFileName
* @return string SIP encoded URL
* @throws CodeException
*/
private function fileToSipUrl($pathFileName) {
$param[DOWNLOAD_MODE] = DOWNLOAD_MODE_FILE;
$param[SIP_DOWNLOAD_PARAMETER] = base64_encode(TOKEN_FILE . PARAM_TOKEN_DELIMITER . $pathFileName);
$url = $this->sip->queryStringToSip(API_DIR . '/' . API_DOWNLOAD_PHP . '?' . KeyValueStringParser::unparse($param, '=', '&'), RETURN_URL);
return $url;
}
/**
* Builds HTML 'input' element.
* Format: <input name="$htmlFormElementName" <type="date" [autocomplete="autocomplete"] [autofocus="autofocus"]
......
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