| Новости | FAQ | Авторы | Документация | В действии | Библиотека |
| Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
max_rip 08.02.2018 13:17 / 08.02.2018 13:23
Как проявляется@upploadFile[....] ... $oImg[^NConvert::create[....]] ^oImg.watermark[...]При этом в методе используются $result(1/0) для возврата статуса.
@watermark[sFileSrc;sFileDest;sWMFile;hParams][fResult]
$hParams[^self._prepareParams[$hParams]]
^if(def $hParams.sPosition && (def $hParams.iX || def $hParams.iY)){
^throw[$sClassName;watermark;Only position or coordinates can be specified]
}
^if(def $sWMFile){
^if(!-f $sWMFile){
^throw[$sClassName;watermark;File '$sWMFile' not found]
}
}{
^throw[$sClassName;watermark;Watermark image MUST be specified]
}
^hParams.add[
^self._getFiles[watermark;$sFileSrc;$sFileDest;$hParams.sFormat;$hParams]
$.sWMFile[$sDocRoot/$sWMFile]
^if(def $hParams.sPosition){
$.sPosition[^self._getPosition[watermark;$hParams.sPosition]]
}
]
$fResult[^self._exec[watermark;$hParams]]
$result($fResult.status) @_exec[sAction;hParams]
^if($hParams.sFormat ne "gif"){
^hParams.delete[iColors]
}
$result[^switch[$sAction]{
^case[info]{^file::exec[$sScript;;-info;$hParams.sInput]}
^case[convert]{^file::exec[$sScript;;-o;$hParams.sOutput;^if(^hParams.bRemoveMeta.int(0)){-rmeta}{-quiet};-out;$hParams.sFormat;-q;$hParams.iQuality;^if($hParams.iColors){-colors}{-quiet};^if($hParams.iColors){$hParams.iColors}{-quiet};$hParams.sInput]}
^case[rotateJPG]{^file::exec[$sScript;;-jpegtrans;$hParams.sAngle;$hParams.sInput]}
^case[rotate]{^file::exec[$sScript;;-o;$hParams.sOutput;-rotate;$hParams.iAngle;-bgcolor;$hParams.iR;$hParams.iG;$hParams.iB;^if($hParams.bRemoveMeta){-rmeta}{-quiet};-out;$hParams.sFormat;-q;$hParams.iQuality;^if($hParams.iColors){-colors}{-quiet};^if($hParams.iColors){$hParams.iColors}{-quiet};$hParams.sInput]}
^case[crop]{^file::exec[$sScript;;-o;$hParams.sOutput;-crop;$hParams.iX;$hParams.iY;$hParams.iCropWidth;$hParams.iCropHeight;^if($hParams.bRemoveMeta){-rmeta}{-quiet};-out;$hParams.sFormat;-q;$hParams.iQuality;^if($hParams.iColors){-colors}{-quiet};^if($hParams.iColors){$hParams.iColors}{-quiet};$hParams.sInput]}
^case[resize]{^file::exec[$sScript;;-o;$hParams.sOutput;-resize;$hParams.sWidth;$hParams.sHeight;^if($hParams.bKeepRatio){-ratio}{-quiet};^if(def $hParams.sFlag){-rflag}{-quiet};^if(def $hParams.sFlag){$hParams.sFlag}{-quiet};-out;$hParams.sFormat;-q;$hParams.iQuality;^if($hParams.iColors){-colors}{-quiet};^if($hParams.iColors){$hParams.iColors}{-quiet};^if($hParams.bRemoveMeta){-rmeta}{-quiet};-rtype;$hParams.sRType;$hParams.sInput]}
^case[watermark]{^file::exec[$sScript;;-o;$hParams.sOutput;-wmfile;$hParams.sWMFile;-wmpos;^hParams.iX.int(0);^hParams.iY.int(0);^if(def $hParams.sPosition){-wmflag}{-quiet};^if(def $hParams.sPosition){$hParams.sPosition}{-quiet};^if($hParams.bRemoveMeta){-rmeta}{-quiet};-out;$hParams.sFormat;-q;$hParams.iQuality;$hParams.sInput]}
^case[DEFAULT]{^throw[$sClassName;;Action '$sAction' not implemented yet]}
}]
#end @_exec