[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Helper/ -> MediaHelper.php (summary)

Joomla! Content Management System

Copyright: (C) 2013 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 490 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MediaHelper:: (11 methods):
  isImage()
  getTypeIcon()
  getMimeType()
  checkMimeType()
  checkFileExtension()
  canUpload()
  imageResize()
  countFiles()
  toBytes()
  isValidLocalDirectory()
  getCleanMediaFieldValue()


Class: MediaHelper  - X-Ref

Media helper class

isImage($fileName)   X-Ref
Checks if the file is an image

param: string  $fileName  The filename
return: boolean

getTypeIcon($fileName)   X-Ref
Gets the file extension for purposed of using an icon

param: string  $fileName  The filename
return: string  File extension to determine icon

getMimeType($file, $isImage = false)   X-Ref
Get the Mime type

param: string   $file     The link to the file to be checked
param: boolean  $isImage  True if the passed file is an image else false
return: mixed    the mime type detected false on error

checkMimeType($mime, $component = 'com_media')   X-Ref
Checks the Mime type

param: string  $mime       The mime to be checked
param: string  $component  The optional name for the component storing the parameters
return: boolean  true if mime type checking is disabled or it passes the checks else false

checkFileExtension($extension, $component = 'com_media', $allowedExecutables = array()   X-Ref
Checks the file extension

param: string  $extension  The extension to be checked
param: string  $component  The optional name for the component storing the parameters
return: boolean  true if it passes the checks else false

canUpload($file, $component = 'com_media', $allowedExecutables = array()   X-Ref
Checks if the file can be uploaded

param: array   $file                File information
param: string  $component           The option name for the component storing the parameters
param: string  $allowedExecutables  Array of executable file types that shall be whitelisted
return: boolean

imageResize($width, $height, $target)   X-Ref
Calculate the size of a resized image

param: integer  $width   Image width
param: integer  $height  Image height
param: integer  $target  Target size
return: array  The new width and height

countFiles($dir)   X-Ref
Counts the files and directories in a directory that are not php or html files.

param: string  $dir  Directory name
return: array  The number of media files and directories in the given directory

toBytes($val)   X-Ref
Small helper function that properly converts any
configuration options to their byte representation.

param: string|integer  $val  The value to be converted to bytes.
return: integer The calculated bytes value from the input.

isValidLocalDirectory($directory)   X-Ref
Method to check if the given directory is a directory configured in FileSystem - Local plugin

param: string  $directory
return: boolean

getCleanMediaFieldValue($value)   X-Ref
Helper method get clean data for value stores in a Media form field by removing adapter information
from the value if available (in this case, the value will have this format:
images/headers/blue-flower.jpg#joomlaImage://local-images/headers/blue-flower.jpg?width=700&height=180)

param: string  $value
return: string



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer