diff --git a/core/modules/responsive_image/responsive_image.module b/core/modules/responsive_image/responsive_image.module index 0d59f57..5519114 100644 --- a/core/modules/responsive_image/responsive_image.module +++ b/core/modules/responsive_image/responsive_image.module @@ -472,11 +472,23 @@ function responsive_image_get_image_dimensions($image_style_name, array $dimensi * The MIME type of the image after the image style is applied. */ function responsive_image_get_mime_type($image_style_name, $extension) { - if ($image_style_name == RESPONSIVE_IMAGE_EMPTY_IMAGE) { - return 'image/gif'; - } - if ($image_style_name !== RESPONSIVE_IMAGE_ORIGINAL_IMAGE) { - $extension = ImageStyle::load($image_style_name)->getDerivativeExtension($extension); + switch ($image_style_name) { + // The file extension for the empty image is 'gif'. + case RESPONSIVE_IMAGE_EMPTY_IMAGE: + $extension = 'gif'; + break; + + // If using the original image, the file extension is just passed on to the + // MIME type mapper. + case RESPONSIVE_IMAGE_ORIGINAL_IMAGE: + break; + + // In all other cases, get the file extension of the derivative image from + // the image style configuration. + default: + $extension = ImageStyle::load($image_style_name)->getDerivativeExtension($extension); + break; + } return \Drupal::service('file.mime_type.mapper')->getMimeTypeForExtension($extension); }