Function __global->is_image
Definitions
sources/images.php
- Find whether the image specified is actually an image, based on file extension.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: bool
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $name | string | No | No | required parameter | N/A | N/A | A URL or file path to the image |
| $criteria | integer | No | No | required parameter | N/A | N/A | A bitmask of IMAGE_CRITERIA_* constants that the image must match |
| $as_admin | boolean | No | No | False | N/A | N/A | Whether there are admin privileges, to render dangerous media types (client-side risk only) |
| $mime_too | boolean | No | No | False | N/A | N/A | Whether to check mime as well as file extension. A full URL must have been passed |
Returns
- Whether the string pointed to a file appeared to be an image
- Type: boolean
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Find whether the image specified is actually an image, based on file extension.
*
* @param string $name A URL or file path to the image
* @param integer $criteria A bitmask of IMAGE_CRITERIA_* constants that the image must match
* @param boolean $as_admin Whether there are admin privileges, to render dangerous media types (client-side risk only)
* @param boolean $mime_too Whether to check mime as well as file extension. A full URL must have been passed
* @return boolean Whether the string pointed to a file appeared to be an image
*/
function is_image(string $name, int $criteria, bool $as_admin = false, bool $mime_too = false) : bool
* Find whether the image specified is actually an image, based on file extension.
*
* @param string $name A URL or file path to the image
* @param integer $criteria A bitmask of IMAGE_CRITERIA_* constants that the image must match
* @param boolean $as_admin Whether there are admin privileges, to render dangerous media types (client-side risk only)
* @param boolean $mime_too Whether to check mime as well as file extension. A full URL must have been passed
* @return boolean Whether the string pointed to a file appeared to be an image
*/
function is_image(string $name, int $criteria, bool $as_admin = false, bool $mime_too = false) : bool

