#6986: Media Processing Html Filter (improved) #8806
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #6986
Originally developed by @anoordende from @zumeymedia in #6992.
Original description
Enabling this feature registers an implementation of
IHtmlFilter
that works on any part with a flavor of "HTML" that injects and applies the registered IHtmlFilters.Additional settings appear under in the Admin UI under
Settings > Media
to control to behavior of this feature. It is quite straightforward:Density Threshold
With a threshold of, for example,
@2x
, an image will only be reduced if the natural size of the image is more than 2x the size specified in the attributes.Quality
Only applies to jpeg's, the quality to compress the image at.
Populate Empty Alt Tags
If the img has an empty Alt tag, one will be composed based on the image file name
noresize attribute
Adding a noresize attribute to any img element will cause the element not to be processed:
<img noresize src="/Media/example.jpg" alt="this image will not be processed" />
_Note that images already the result of a profile (ie already under /Profiles/*) will not be processed.
To try out this feature, simply add a suitable image from your media library to e.g. a body part and use the handles in the editor the resize the image. When rendered, you will see that the image comes from a profile and not from the original source. Change the quality or density in the settings and you will see new profiles being generated.
Clean up the dynamic test profiles or force regeneration with the "Purge Obsolete" feature from PR #6984.