1 image.inc image_get_supported_extensions()

Gets supported image extensions.

Backdrop supports GIF, JPG, PNG, and WEBP file formats when supported by the GD toolkit, and may support others, depending on the currently used toolkit.

@since 1.25.0 Function added.

Return value

array: Array of supported extensions.

Related topics

File

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

Code

function image_get_supported_extensions() {
  $toolkit = image_get_toolkit();
  $function = 'image_' . $toolkit . '_supported_extensions';
  if (function_exists($function)) {
    $extensions = $function();
    $extensions[] = 'svg';
    return $extensions;
  }
  watchdog('image', 'The selected image handling toolkit %toolkit should provide a %function callback.', 
  array(
    '%toolkit' => $toolkit,
    '%function' => $function), 
  WATCHDOG_ERROR
  );
  // Provide a fallback list of extensions.
  return array('jpg', 'jpeg', 'gif', 'png');
}