Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Minify: Skip files without minifier & replace faulty message #1057

Open
wants to merge 3 commits into
base: 3.x
Choose a base branch
from

Conversation

pixelbrackets
Copy link
Contributor

Overview

This pull request:

  • Fixes a bug
  • Adds a feature
  • Breaks backwards compatibility
  • Has tests that cover changes
  • Adds or fixes documentation

Summary

Fixes a faulty error message in case the image minifier processes all files,
and does not crash before, but some images can not be minified.

Also skip the minification process for all files which have no minifier set.
This allows to continue the task and not stop the minification process
for all files.

Description

In case of an error the message contains placeholders which
are not replaced anymore downstream
(Minified {filecount} out of {filetotal} images into {destination}).
Print the result message as info and then return a short task message
without placeholders instead.

Early return for all files which have no minifier set,
to avoid fatal error with ambigous error message
“Minifier method cannot be found!”.
For example when webp images exist in the image directory.
The files are added to the error list right away,
to that the task may continue to minify other images and
show a result message (“Minified X of Y files”) at the end.

In case of an error the message contains placeholders which
are not replaced anymore downstream
(`Minified {filecount} out of {filetotal} images into {destination}`).
Print the result message as info and then return a short task message
without placeholders instead.
Early return for all files which have no minifier set,
to avoid an fatal error with the ambigous error message
“Minifier method  cannot be found!”.
For example when webp images exist in the image directory.

The files are added to the error list right away,
to that the task may continue to minify other images and
show a result message (“Minified X of Y files”) at the end.
@pixelbrackets pixelbrackets force-pushed the 20211110_fix-imageminify-no-image-file branch from a0a1e5e to 8ea2326 Compare November 10, 2021 18:24
@greg-1-anderson
Copy link
Member

I would take this, but it needs a forward-port to the 4.x branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants