1 image.inc image_is_svg($uri)

Determine if a file URI is an SVG image based on its file extension.

@since 1.28.0 Function added.

Parameters

string $uri: A path or URI to an image.

Return value

bool: TRUE if the image is an SVG. FALSE if it is not.

Related topics

File

core/includes/image.inc, line 564
API for manipulating images.

Code

function image_is_svg($uri) {
  $mimetype = file_get_mimetype($uri);
  return $mimetype === 'image/svg+xml';
}