DocumentTransformer extends FileTransformer
Class Document High-level logic to work with commands for documents.
Make transformation of a document (.doc, .xls, .pdf and others formats) supported by Libre Office Correct transformation: .doc|.docx|.odt => pdf|jpg|txt|text .xls|.xlsx|.ods => pdf|jpg .pdf => jpg.
Table of Contents
Constants
- CACHE_PATH = '/bx/transformer/command/'
- CRC32 = 'crc32'
- CSV = 'csv'
- IMAGE = 'jpg'
- MAX_EXECUTION_TIME = 14400
- MAX_FILESIZE = 104857600
- MD5 = 'md5'
- PDF = 'pdf'
- SHA1 = 'sha1'
- TEXT = 'text'
- TXT = 'txt'
Methods
- call() : mixed
- Example callback that will be invoked after transformation to process results.
- clearInfoCache() : mixed
- Clears cache of command info on $file.
- getTransformationInfoByFile() : bool|array<string|int, mixed>
- Get information of the last transformation command of the file.
- getTransformerCommandName() : string
- transform() : Result
- Make transformation of a file
Constants
CACHE_PATH
public
mixed
CACHE_PATH
= '/bx/transformer/command/'
CRC32
public
mixed
CRC32
= 'crc32'
CSV
public
mixed
CSV
= 'csv'
IMAGE
public
mixed
IMAGE
= 'jpg'
MAX_EXECUTION_TIME
Transformer module handles timeouts on its own. You don't need to check max execution time.
public
mixed
MAX_EXECUTION_TIME
= 14400
MAX_FILESIZE
public
mixed
MAX_FILESIZE
= 104857600
MD5
public
mixed
MD5
= 'md5'
public
mixed
PDF
= 'pdf'
SHA1
public
mixed
SHA1
= 'sha1'
TEXT
public
mixed
TEXT
= 'text'
TXT
public
mixed
TXT
= 'txt'
Methods
call()
Example callback that will be invoked after transformation to process results.
public
static call(int $status, string $command, array<string|int, mixed> $params[, array<string|int, mixed> $result = [] ]) : mixed
Parameters
- $status : int
-
Status of the command in b_transformer_command.
- $command : string
-
Name of the command.
- $params : array<string|int, mixed>
-
Parameters of the command.
- $result : array<string|int, mixed> = []
-
Result of the command from controller array ( 'files' => array ( 'extension' => 'url', ... ) 'md5' => 'md5 sum', 'crc32' => 'crc32 sum', 'sha1' => 'sha1 sum', ... ).
clearInfoCache()
Clears cache of command info on $file.
public
static clearInfoCache(int|string $file) : mixed
Parameters
- $file : int|string
-
- ID in b_file or path.
getTransformationInfoByFile()
Get information of the last transformation command of the file.
public
static getTransformationInfoByFile(int|string $file) : bool|array<string|int, mixed>
array status - int time - DateTime id - int
Parameters
- $file : int|string
-
- ID in b_file or path.
Return values
bool|array<string|int, mixed>getTransformerCommandName()
public
final static getTransformerCommandName() : string
Return values
stringtransform()
Make transformation of a file
public
transform(int|string $file, array<string|int, mixed> $formats, string|array<string|int, mixed> $module, string|array<string|int, mixed> $callback[, array<string|int, mixed> $params = [] ]) : Result
Parameters
- $file : int|string
-
ID from b_file or path to the file.
- $formats : array<string|int, mixed>
-
What to do with the file.
- $module : string|array<string|int, mixed>
-
Module name (one or several). These modules will be included before callback.
- $callback : string|array<string|int, mixed>
-
Callback(s) to call with results.
- $params : array<string|int, mixed> = []
-
Extra params.