1 image.gd.inc | image_gd_supported_extensions() |
Retrieve supported extensions for the GD2 toolkit.
@since 1.25.0 Function added.
Related topics
File
- core/
modules/ system/ image.gd.inc, line 34 - GD2 toolkit for image manipulation within Backdrop.
Code
function image_gd_supported_extensions() {
$supported_extensions = array('png', 'gif', 'jpg', 'jpeg');
if (defined('IMAGETYPE_WEBP')) {
$gd_info = gd_info();
if (isset($gd_info['WebP Support']) && $gd_info['WebP Support'] == TRUE) {
// Extend supported extensions, as the PHP and GD versions support WebP.
// IMAGETYPE_WEBP and getimagesize() WebP support were both added in
// PHP 7.1.0.
// @see https://www.php.net/manual/en/image.constants.php
// @see https://www.php.net/manual/en/function.getimagesize.php
$supported_extensions[] = 'webp';
}
}
return $supported_extensions;
}