Problem/Motivation

Follow-up from #3275557: Add webp image conversion to core's install profile's image style which didn't actually do what the issue summary suggested.

We should add a webp image conversion to all shipped image styles with core install profiles.

Steps to reproduce

NA

Proposed resolution

add a webp image conversion to all shipped image styles

Remaining tasks

Update remaining styles
Review

User interface changes

NA

API changes

NA

Data model changes

NA

Release notes snippet

NA

Issue fork drupal-3406267

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

catch created an issue. See original summary.

jastraat’s picture

Quick clarifying questions on this one:

Should the convert to webp also be added to the default config from the Drupal core image module? (That would include the large, medium, thumbnail, etc styles.)

And is this truly just to add something like the following as an additional entry in the "effects" section of all image.style.*.yml files in core install profiles?

    e037ec38-0f1e-425b-90f2-a80e622df793:
    uuid: e037ec38-0f1e-425b-90f2-a80e622df793
    id: image_convert
    weight: 2
    data:
      extension: webp
andypost’s picture

Yes, amd it should be the last effect

andypost’s picture

catch’s picture

Title: All core install profile image styles should include webp conversion » All core shipped image styles should include webp conversion

@jastraat yes makes sense to do those here too, I updated the issue title.

prashant.c’s picture

Can you provide guidance on where to implement these modifications? Are they intended to be made within the image.style.[name].yml files located inside profile config files? For instance, in the case of Umami, would these changes be applied in files such as core/profiles/demo_umami/config/install/image.style.large_3_2_2x.yml, as well as other relevant image style configuration files? Thank you.

deepak.cms’s picture

StatusFileSize
new2.1 KB

@catch, I added the WEBP image effect to default styles that comes with Standard Installation from image module.

catch’s picture

@deepak.cms - that looks fine. Can you also apply the same thing to the Umami install profile image styles? It would also be good to use an MR rather than a patch here (Drupal.org is moving away from patches).

deepak.cms’s picture

Sure, I will update it in MR. Thanks

deepak.cms’s picture

Assigned: Unassigned » deepak.cms
catch’s picture

Status: Active » Needs work

Sounds good - moving to needs work since there's already some code here.

deepak.cms’s picture

@catch, MR created please review.

catch’s picture

Status: Needs work » Needs review
marvil07’s picture

Status: Needs review » Needs work

CI reports some errors at ConfigSchemaTest and ResponsiveImageFieldDisplayTest tests.
Both of them seem to be relevant, so moving to NW.

Several of them may be about actually changing the test, that was assuming a different context, like the png string match.

Copying here the relevant output from each of them in CI output.

---- Drupal\KernelTests\Core\Config\ConfigSchemaTest ----


Status    Group      Filename          Line Function                            
--------------------------------------------------------------------------------
Fail      Other      phpunit-175.xml      0 Drupal\KernelTests\Core\Config\Conf
    PHPUnit Test failed to complete; Error: PHPUnit 9.6.15 by Sebastian
Bergmann and contributors.

Testing Drupal\KernelTests\Core\Config\ConfigSchemaTest
..F........                                                       11 / 11
(100%)

Time: 00:12.394, Memory: 4.00 MB

There was 1 failure:

1) Drupal\KernelTests\Core\Config\ConfigSchemaTest::testSchemaData
Got an array with effects for image.style.large data
Failed asserting that actual size 2 matches expected size 1.

/builds/issue/drupal-3406267/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121
/builds/issue/drupal-3406267/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
/builds/issue/drupal-3406267/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php:360
/builds/issue/drupal-3406267/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

FAILURES!
Tests: 11, Assertions: 74, Failures: 1.
---- Drupal\Tests\responsive_image\Functional\ResponsiveImageFieldDisplayTest ----


Status    Group      Filename          Line Function
--------------------------------------------------------------------------------
Exception Other      phpunit-3.xml        0 Drupal\Tests\responsive_image\Funct
   PHPUnit Test failed to complete; Error: PHPUnit 9.6.15 by Sebastian
Bergmann and contributors.

Testing
Drupal\Tests\responsive_image\Functional\ResponsiveImageFieldDisplayTest
EE....E                                                             7 / 7
(100%)

Time: 01:04.705, Memory: 4.00 MB

There were 3 errors:

1)
Drupal\Tests\responsive_image\Functional\ResponsiveImageFieldDisplayTest::testResponsiveImageFieldFormattersPublic
Behat\Mink\Exception\ExpectationException: The string "type="image/png""
was not found anywhere in the HTML response of the current page.

/builds/issue/drupal-3406267/vendor/behat/mink/src/WebAssert.php:794
/builds/issue/drupal-3406267/vendor/behat/mink/src/WebAssert.php:324
/builds/issue/drupal-3406267/core/tests/Drupal/Tests/WebAssert.php:540
/builds/issue/drupal-3406267/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php:333
/builds/issue/drupal-3406267/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php:93
/builds/issue/drupal-3406267/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

2)
Drupal\Tests\responsive_image\Functional\ResponsiveImageFieldDisplayTest::testResponsiveImageFieldFormattersPrivate
Behat\Mink\Exception\ExpectationException: The string "type="image/png""
was not found anywhere in the HTML response of the current page.

/builds/issue/drupal-3406267/vendor/behat/mink/src/WebAssert.php:794
/builds/issue/drupal-3406267/vendor/behat/mink/src/WebAssert.php:324
/builds/issue/drupal-3406267/core/tests/Drupal/Tests/WebAssert.php:540
/builds/issue/drupal-3406267/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php:333
/builds/issue/drupal-3406267/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php:103
/builds/issue/drupal-3406267/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

3)
Drupal\Tests\responsive_image\Functional\ResponsiveImageFieldDisplayTest::testResponsiveImageFieldFormattersMultipleSources
Behat\Mink\Exception\ExpectationException: The pattern /\s+\s+\s+\s+/ was
not found anywhere in the HTML response of the page.

/builds/issue/drupal-3406267/vendor/behat/mink/src/WebAssert.php:794
/builds/issue/drupal-3406267/vendor/behat/mink/src/WebAssert.php:354
/builds/issue/drupal-3406267/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php:509
/builds/issue/drupal-3406267/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

ERRORS!
Tests: 7, Assertions: 187, Errors: 3.
deepak.cms’s picture

Hi @marvil07,

I updated the test cases for two image effects in the default styles. Please review it again.

Thanks

deepak.cms’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Surprised tests passed but don’t believe we should be shipping config with uuids.

nireneko’s picture

Status: Needs work » Needs review

@smustgrave Checking the current config files (https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/image... and https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/image... for example) the uuids of the image effects are there, I'd say it's ok.

smustgrave’s picture

Issue summary: View changes
Status: Needs review » Needs work

Missing some updates

There's an image.style in
media_library
demo_umami/optional
standard profile

deepak.cms’s picture

Hi @smustgrave,

Updated all image styles. Please review again.

Thanks

djsagar’s picture

Issue tags: +Needs tests
catch’s picture

Issue tags: -Needs tests

This doesn't need tests, it's just a change to the default config.

deepak.cms’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new11.82 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

deepak.cms’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Current MR has failures.

kostyashupenko made their first commit to this issue’s fork.

kostyashupenko’s picture

Seems rebase didn't help. After local investigation also no results. No errors on spellcheck. Can you guide me if you will have an ability to fix it - what was a cause of it?

kostyashupenko’s picture

CI reports in spellcheck job are not so informative

andypost’s picture

Assigned: deepak.cms » Unassigned
Status: Needs work » Needs review

I started new pipeline and it passed, also extended core/profiles/standard/tests/src/Functional/StandardTest.php test for shipped effects

As the #23 said no reason for test, I still sure standard profile needs at least this small addition

smustgrave’s picture

smustgrave changed the visibility of the branch 11.x to hidden.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

New pipeline seemed to do the trick. Believe all feedback has been addressed

quietone’s picture

Status: Reviewed & tested by the community » Needs review

I'm triaging RTBC issues. I read the IS and the comments. I didn't find any unanswered questions.

I read the MR and I don't have any questions. I then applied the diff and searched core to ensure that all image styles are updated.

$ find . -iname image.style\*  | sed -e "s/.\///" | sort -u > core.out
$ git status | grep image.style | awk '{print $2}' | sort -u   >  mr.out
$ diff mr.out core.out
4a5
> core/modules/image/help_topics/image.style.html.twig
13a15,19
> core/profiles/demo_umami/config/install/image.style.scale_crop_7_3_large.yml
> core/profiles/demo_umami/config/install/image.style.scale_crop_7_3_medium.yml
> core/profiles/demo_umami/config/install/image.style.scale_crop_7_3_small.yml
> core/profiles/demo_umami/config/install/image.style.scale_crop_7_3_tiny.yml
> core/profiles/demo_umami/config/install/image.style.scale_crop_7_3_wide.yml

Why are these files not changes?

smustgrave’s picture

@quietone those already contain the code

Example > core/profiles/demo_umami/config/install/image.style.scale_crop_7_3_small.yml

  d5eb26a0-f961-4ba4-9f01-94a44440b4fa:
    uuid: d5eb26a0-f961-4ba4-9f01-94a44440b4fa
    id: image_convert
    weight: 2
    data:
      extension: webp
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Restoring status.

  • catch committed 4a64e1ab on 11.x
    Issue #3406267 by deepak.cms, andypost, kostyashupenko, smustgrave,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Added a change record; https://www.drupal.org/node/3421405 and committed/pushed to 11.x, thanks!

longwave’s picture

Nice work, tagging this as a highlight for the release announcement.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.