-
Notifications
You must be signed in to change notification settings - Fork 106
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
Allow for modification or removal of the -jpg suffix added to webp images, generated from jpg files #545
Comments
I second that, a filter for the suffix would be great! i used a plugin that created myimage.jpg -> myimage.jpg.webp and i'm serving those images via url rewrite. So to be able to keep serving my existing images and create new ones with the performance lab plugin it would be handy to be able to to change the suffix of the generated files! Thx paul |
Thanks, Paul, for the comment. Some background for the image extension. Plugin added the original image's extension to the WebP file name for its uniqueness in #444, for two or more images share the same file name but different mime types. If you are aware of the rise of the same file name with different mime types issue, the filter is a good option for removing file name extensions. Filter that adds an extension to the image name. The default value for this filter is true, so it doesn't affect the current behavior of the plugin.
@felixarntz and @adamsilverstein, I would be interested to hear your thoughts on this? Please review and suggest wording if I missed anything. |
I'm open to the idea of introducing some developer control here, however we may want something broader to control naming overall. We may want to hold and revisit this once we consider adjusting the approach in the plugin to match where we wound up in core. |
How about selections between: filename.jpg to filename.jpg.webp or filename.webp |
That would be compatible with redirection convention used on most hosting providers, even WordOps is using it by default. Current renaming convention is pure nonsense. I guess, someone was mislead or inspired with -cropped and -rotated suffix, but that was appropriate because it is for completely different purpose. Anyways, I wonder what else could be purpose of WebP upload module keeping jpeg thumbnails than enabling redirection for WebP enabled/disabled browsers? Same convention should be implemented for original.jpg |
Upload name is always checked for duplicate names and renamed. Thumbnails names just follow original / renamed file. That works without problems for decades. Same will work for .jpeg.webp because it will never be duplicate of original-name.jpeg. Even when .jpeg thumbnails are not generated (skipped). |
This "thing" should never "wound up in core". Image Editor Class is already capable of generating both media/types (when library supports), and is already capable to regenerate images. Which is not the case with WebP - upload module that does it's "thing" only on upload. All you have to do is to handle name and use |
@ddur are you sure about that? WebPs should be generated when regenerating images as well as at upload. |
This issue just came up in another support topic: https://wordpress.org/support/topic/images-rename/ |
Hello Paul, |
I think it would be good to bring this up in this discussion. If I regenerate existing files more than once, the extension keeps building up... When I regenerate thumbnails using that plugin, it creates a new file. I am creating webp files, and it works pretty great, but every time I do that to update existing files, it adds to the end of the filename: “-oldext.webp”, but it does it even to previously generated webp files. If you run it once, it changes filename.jpg to filename-jpg.webp. If you run it a second time, it creates a new file instead of replacing the existing, and changes the name to filename-jpg-webp.webp. A third time gets you filename-jpg-webp-webp.webp. |
Feature Description
As per a user request in the forums allow for modification or removal of the naming structure of webp images that are generated from jpg files. At present when webp files are created from uploaded jpg they include a -jpg suffix.
Example: If I upload
myimage.jpg
the respective webp version will be titledmyimage-jpg.webp
Update: The below support topics also reference issues or queries regarding the file names that were added:
The text was updated successfully, but these errors were encountered: