Download the PHP package dd/evolutioncms-snippets-ddgetfileinfo without Composer
On this page you can find all versions of the php package dd/evolutioncms-snippets-ddgetfileinfo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download dd/evolutioncms-snippets-ddgetfileinfo
More information about dd/evolutioncms-snippets-ddgetfileinfo
Files in dd/evolutioncms-snippets-ddgetfileinfo
Download dd/evolutioncms-snippets-ddgetfileinfo
More information about dd/evolutioncms-snippets-ddgetfileinfo
Files in dd/evolutioncms-snippets-ddgetfileinfo
Vendor dd
Package evolutioncms-snippets-ddgetfileinfo
Short Description Displays information about a file: type, mime, size in readable format, path, name, extension, etc.
License
Homepage https://code.divandesign.biz/modx/ddgetfileinfo
Package evolutioncms-snippets-ddgetfileinfo
Short Description Displays information about a file: type, mime, size in readable format, path, name, extension, etc.
License
Homepage https://code.divandesign.biz/modx/ddgetfileinfo
Please rate this library. Is it a good library?
Informations about the package evolutioncms-snippets-ddgetfileinfo
(MODX)EvolutionCMS.snippets.ddGetFileInfo
Displays information about a file: type, mime, size in readable format, path, name, extension, etc.
Requires
- PHP >= 5.6
- (MODX)EvolutionCMS >= 1.1
- (MODX)EvolutionCMS.libraries.ddTools >= 0.49
Documentation
Installation
Manually
1. Elements → Snippets: Create a new snippet with the following data
- Snippet name:
ddGetFileInfo
. - Description:
<b>2.5</b> Displays information about a file: type, mime, size in readable format, path, name, extension, etc.
. - Category:
Core
. - Parse DocBlock:
no
. - Snippet code (php): Insert content of the
ddGetFileInfo_snippet.php
file from the archive.
2. Elements → Manage Files
- Create a new folder
assets/snippets/ddGetFileInfo/
. - Extract the archive to the folder (except
ddGetFileInfo_snippet.php
).
Using (MODX)EvolutionCMS.libraries.ddInstaller
Just run the following PHP code in your sources or Console:
- If
ddGetFileInfo
is not exist on your site,ddInstaller
will just install it. - If
ddGetFileInfo
is already exist on your site,ddInstaller
will check it version and update it if needed.
Parameters description
-
file
- Desctription: File name (path).
- Valid values:
stringFilePath
— the path to the file can be specified relative to the site root (/
at the beginning does not matter, both variants are supported), or the full path (including$modx->config['base_path']
)stringUrl
— you can specify not only a local file, but also an Internet address, but in this case not all functions are supported for objective reasons
- Required
-
file_docField
- Desctription: A document field (including TV) containing the path to the file (if you want the snippet to get the file address from the document field).
- Valid values:
string
- Default value: —
-
file_docId
- Desctription: Resource ID, from the field of which you want to get the file address.
- Valid values:
integerDocId
- Default value: —
-
sizeUnitFormat
- Desctription: Format of file size unit.
Values are case insensitive (the following names are equal:'enshort'
,'EnShort'
,'ENSHORT'
, etc). - Valid values:
'none'
'EnShort'
— e. g.MB
'EnFull'
— e. g.Megabyte
'RuShort'
— e. g.Мб
'RuFull'
— e. g.Мегабайт
- Default value:
'EnShort'
- Desctription: Format of file size unit.
-
sizePrecision
- Desctription: The number of decimal digits to round to.
- Valid values:
integer
- Default value:
2
-
output
- Desctription: File information to output (if
tpl
is not set). - Valid values:
'size'
'extension'
'type'
'typeMime'
'name'
'path'
- Default value:
'size'
- Desctription: File information to output (if
-
tpl
- Desctription: Output template (if the parameter is absent, file data corresponding to
output
will be returned).
Available placeholders:[+file+]
— full file address[+name+]
— file name[+path+]
— file path[+size+]
— file size with a unit in a human-readable format[+extension+]
— file extension[+type+]
— file type:'archive'
'image'
'video'
'audio'
'text'
'pdf'
'word'
'excel'
'powerpoint'
[+typeMime+]
— content type in MIME format (only for local files, not for URLs)
- Valid values:
stringChunkName
string
— use inline templates starting with@CODE:
- Default value: —
- Desctription: Output template (if the parameter is absent, file data corresponding to
tpl_placeholders
- Desctription:
Additional data has to be passed into the
tpl
.
Nested objects and arrays are supported too:{"someOne": "1", "someTwo": "test" }
=>[+someOne+], [+someTwo+]
.{"some": {"a": "one", "b": "two"} }
=>[+some.a+]
,[+some.b+]
.{"some": ["one", "two"] }
=>[+some.0+]
,[+some.1+]
.
- Valid values:
stringJsonObject
— as JSONstringHjsonObject
— as HJSONstringQueryFormated
— as Query string- It can also be set as a native PHP object or array (e. g. for calls through
$modx->runSnippet
):arrayAssociative
object
- Default value: —
- Desctription:
Additional data has to be passed into the
Examples
Run the snippet through \DDTools\Snippet::runSnippet
without DB and eval
Links
All versions of evolutioncms-snippets-ddgetfileinfo with dependencies
PHP Build Version
Package Version
The package dd/evolutioncms-snippets-ddgetfileinfo contains the following files
Loading the files please wait ....