Skip to content

Allow developers to select which image format to use for images in the content - #230

Merged
felixarntz merged 9 commits into
release/1.0.0-beta.2from
feature/187-content-images-format
Mar 18, 2022
Merged

felixarntz merged 9 commits into
release/1.0.0-beta.2from
feature/187-content-images-format

Conversation

@eugene-manuilov

@eugene-manuilov eugene-manuilov commented Mar 15, 2022

Copy link
Copy Markdown
Contributor

Summary

Fixes #187

Relevant technical choices

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

@eugene-manuilov eugene-manuilov added [Type] Enhancement A suggestion for improvement of an existing feature [Focus] Images labels Mar 15, 2022
@eugene-manuilov eugene-manuilov added this to the 1.0.0-beta.2 milestone Mar 15, 2022
@eugene-manuilov eugene-manuilov changed the title Feature/187 content images format Allow developers to select which image format to use for images in the content Mar 15, 2022

@mitogh mitogh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment about the code.

Would be great to introduce some tests to test cases like:

  • Default behavior
  • Reverse behavior
  • Empty value
  • Unsupported mime types

Comment thread modules/images/webp-uploads/load.php

@felixarntz felixarntz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eugene-manuilov Looks great, just one comment.

Comment thread modules/images/webp-uploads/load.php
@adamsilverstein

Copy link
Copy Markdown
Member

Overall looks good although I still prefer to have the filter operate in the opposite order. Also, it would be good to add some tests verifying that the filter works as expected.

@felixarntz

Copy link
Copy Markdown
Member

@adamsilverstein

Overall looks good although I still prefer to have the filter operate in the opposite order.

The benefit of how it currently behaves is that the order of how items have to be sorted in the filter itself is arguably more aligned with the other filter, with the "foundational" format coming first (typically JPEG for our purposes currently). The reason we then iterate through the array backwards here is because the "priority order" of the formats would be actually the opposite, which especially makes sense when thinking about it in the context of future picture element support. Basically, the most advanced modern format should come first, but it's also the most likely format to not be supported by the browser. So there have to be fallbacks, all the way back to the "foundational" format which is expected to work everywhere.

Also, it would be good to add some tests verifying that the filter works as expected.

+1 to that, @eugene-manuilov could you add a few tests for the filter usage?

@adamsilverstein

Copy link
Copy Markdown
Member

which especially makes sense when thinking about it in the context of future picture element support.