Back to MediaHelper class

Method isImage

public static bool
isImage
(mixed $fileName)
Checks if the file is an image
Parameters
  • string $fileName The filename
Returns
  • bool
Since
  • 3.2
Class: MediaHelper
Project: Joomla

Method isImage - Source code

/**
 * Checks if the file is an image
 *
 * @param   string  $fileName  The filename
 *
 * @return  boolean
 *
 * @since   3.2
 */
public static function isImage($fileName)
{
    static $imageTypes = 'xcf|odg|gif|jpg|jpeg|png|bmp|webp';
    return preg_match("/\\.(?:{$imageTypes})\$/i", $fileName);
}