diff --git a/core/modules/responsive_image/responsive_image.module b/core/modules/responsive_image/responsive_image.module index ec4dbe1..f3fc585 100644 --- a/core/modules/responsive_image/responsive_image.module +++ b/core/modules/responsive_image/responsive_image.module @@ -18,6 +18,7 @@ * The machine name for the empty image breakpoint image style option. */ const RESPONSIVE_IMAGE_EMPTY_IMAGE = '_empty image_'; +const RESPONSIVE_IMAGE_ORIGINAL_IMAGE = '_original image_'; /** * Implements hook_help(). @@ -456,7 +457,12 @@ function responsive_image_get_mime_type($image_style_name, $extension) { } // The MIME type guesser needs a full path, not just an extension, but the // file doesn't have to exist. - $fake_path = 'responsive_image.' . ImageStyle::load($image_style_name)->getDerivativeExtension($extension); + if ($image_style_name == RESPONSIVE_IMAGE_ORIGINAL_IMAGE) { + $fake_path = 'responsive_image.' . $extension; + } + else { + $fake_path = 'responsive_image.' . ImageStyle::load($image_style_name)->getDerivativeExtension($extension); + } return Drupal::service('file.mime_type.guesser.extension')->guess($fake_path); } diff --git a/core/modules/responsive_image/src/ResponsiveImageStyleForm.php b/core/modules/responsive_image/src/ResponsiveImageStyleForm.php index 9e10fe9..fbf892a 100644 --- a/core/modules/responsive_image/src/ResponsiveImageStyleForm.php +++ b/core/modules/responsive_image/src/ResponsiveImageStyleForm.php @@ -84,6 +84,7 @@ public function form(array $form, FormStateInterface $form_state) { ); $image_styles = image_style_options(TRUE); + $image_styles[RESPONSIVE_IMAGE_ORIGINAL_IMAGE]= t('- None (original image) -'); $image_styles[RESPONSIVE_IMAGE_EMPTY_IMAGE] = $this->t('- empty image -'); if ((bool) $responsive_image_style->id() && $this->operation != 'duplicate') { diff --git a/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php b/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php index 63580a8..f019c35 100644 --- a/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php +++ b/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php @@ -208,6 +208,10 @@ public function testGetKeyedImageStyleMappings() { 'image_mapping_type' => 'image_style', 'image_mapping' => 'thumbnail', )); + $entity->addImageStyleMapping('test_breakpoint2', '2x', array( + 'image_mapping_type' => 'image_style', + 'image_mapping' => '_original image_', + )); $expected = array( 'test_breakpoint' => array( @@ -236,6 +240,12 @@ public function testGetKeyedImageStyleMappings() { 'image_mapping_type' => 'image_style', 'image_mapping' => 'thumbnail', ), + '2x' => array( + 'breakpoint_id' => 'test_breakpoint2', + 'multiplier' => '2x', + 'image_mapping_type' => 'image_style', + 'image_mapping' => '_original image_', + ), ) ); $this->assertEquals($expected, $entity->getKeyedImageStyleMappings());