Back to Joomla project (class list)

Class MediaHelper - list of methods

Media helper class
Package: Joomla\CMS\Helper
Copyright: (C) 2013 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Helper/MediaHelper.php
Project: Joomla

Method Summary

public static bool
(mixed $fileName)

Checks if the file is an image
Parameters
  • string $fileName The filename
Returns
  • bool
Since
  • 3.2
Show source code of this method: isImage Source Code

public static string
(mixed $fileName)

Gets the file extension for purposed of using an icon
Parameters
  • string $fileName The filename
Returns
  • string File extension to determine icon
Since
  • 3.2
Show source code of this method: getTypeIcon Source Code

public static mixed
(mixed $file, mixed $isImage = false)

Get the Mime type
Parameters
  • string $file The link to the file to be checked
  • bool $isImage True if the passed file is an image else false
Returns
  • mixed the mime type detected false on error
Since
  • 3.7.2
Show source code of this method: getMimeType Source Code

private bool
(mixed $mime, mixed $component = 'com_media')

Checks the Mime type
Parameters
  • string $mime The mime to be checked
  • string $component The optional name for the component storing the parameters
Returns
  • bool true if mime type checking is disabled or it passes the checks else false
Since
  • 3.7
Show source code of this method: checkMimeType Source Code

public static bool
(mixed $extension, mixed $component = 'com_media', mixed $allowedExecutables = array())

Checks the file extension
Parameters
  • string $extension The extension to be checked
  • string $component The optional name for the component storing the parameters
Returns
  • bool true if it passes the checks else false
Since
  • 4.0.0
Show source code of this method: checkFileExtension Source Code

public bool
(mixed $file, mixed $component = 'com_media', mixed $allowedExecutables = array())

Checks if the file can be uploaded
Parameters
  • array $file File information
  • string $component The option name for the component storing the parameters
  • string $allowedExecutables Array of executable file types that shall be whitelisted
Returns
  • bool
Since
  • 3.2
Show source code of this method: canUpload Source Code

public static array
(mixed $width, mixed $height, mixed $target)

Calculate the size of a resized image
Parameters
  • int $width Image width
  • int $height Image height
  • int $target Target size
Returns
  • array The new width and height
Since
  • 3.2
Show source code of this method: imageResize Source Code

public array
(mixed $dir)

Counts the files and directories in a directory that are not php or html files.
Parameters
  • string $dir Directory name
Returns
  • array The number of media files and directories in the given directory
Since
  • 3.2
Show source code of this method: countFiles Source Code

public int
(mixed $val)

Small helper function that properly converts any configuration options to their byte representation.
Parameters
  • string|int $val The value to be converted to bytes.
Returns
  • int The calculated bytes value from the input.
Since
  • 3.3
Show source code of this method: toBytes Source Code

public static bool
(mixed $directory)

Method to check if the given directory is a directory configured in FileSystem - Local plugin
Parameters
  • string $directory
Returns
  • bool
Since
  • 4.0.0
Show source code of this method: isValidLocalDirectory Source Code

public static string
(mixed $value)

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)
Parameters
  • string $value
Returns
  • string
Since
  • 4.0.0
Show source code of this method: getCleanMediaFieldValue Source Code

Constants Summary

public string[]
$EXECUTABLES
A special list of blocked executable extensions, skipping executables that are typically executable in the webserver context as those are fetched from Joomla\CMS\Filter\InputFilter
Since
  • 4.0.0

Tags Summary

Since
3.2