MediaHelper
Media helper class
since |
3.2 |
---|
Methods
canUpload
Checks if the file can be uploaded
canUpload(array $file, string $component = 'com_media', string $allowedExecutables = array()) : boolean
since |
3.2 |
---|
Arguments
- $file
array
File information- $component
string
The option name for the component storing the parameters- $allowedExecutables
string
Array of executable file types that shall be whitelisted
Response
boolean
checkMimeType
Checks the Mime type
checkMimeType(string $mime, string $component = 'com_media') : boolean
since |
3.7 |
---|
Arguments
- $mime
string
The mime to be checked- $component
string
The optional name for the component storing the parameters
Response
boolean
true if mime type checking is disabled or it passes the checks else false
countFiles
Counts the files and directories in a directory that are not php or html files.
countFiles(string $dir) : array
since |
3.2 |
---|
Arguments
- $dir
string
Directory name
Response
array
The number of media files and directories in the given directory
getMimeType
Get the Mime type
getMimeType(string $file, boolean $isImage = false) : mixed
since |
3.7.2 |
---|
Arguments
- $file
string
The link to the file to be checked- $isImage
boolean
True if the passed file is an image else false
Response
mixed
the mime type detected false on error
getTypeIcon
Gets the file extension for purposed of using an icon
getTypeIcon(string $fileName) : string
since |
3.2 |
---|
Arguments
- $fileName
string
The filename
Response
string
File extension to determine icon
imageResize
Calculate the size of a resized image
imageResize(integer $width, integer $height, integer $target) : array
since |
3.2 |
---|
Arguments
- $width
integer
Image width- $height
integer
Image height- $target
integer
Target size
Response
array
The new width and height
isImage
Checks if the file is an image
isImage(string $fileName) : boolean
since |
3.2 |
---|
Arguments
- $fileName
string
The filename
Response
boolean
toBytes
Small helper function that properly converts any configuration options to their byte representation.
toBytes(string|integer $val) : integer
since |
3.3 |
---|
Arguments
- $val
string|integer
The value to be converted to bytes.
Response
integer
The calculated bytes value from the input.