-
Notifications
You must be signed in to change notification settings - Fork 37
Convert images to optimized formats #50
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
base: master
Are you sure you want to change the base?
Convert images to optimized formats #50
Conversation
…task/format-conversion
…task/format-conversion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the feature to convert images to optimized formats (WebP/AVIF) by integrating Tinify API functionality and updating the integration tests accordingly.
- Added conversion settings tests to settings.spec.ts.
- Introduced a new conversion.spec.ts to verify conversion behavior and display.
- Updated bulkoptimization.spec.ts to incorporate conversion settings.
Reviewed Changes
Copilot reviewed 17 out of 34 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
test/integration/settings.spec.ts | Added tests for conversion settings in the image optimization workflow. |
test/integration/conversion.spec.ts | New tests to verify image conversion functionality and display. |
test/integration/bulkoptimization.spec.ts | Adjusted imports to include conversion settings for bulk optimizations. |
Files not reviewed (17)
- .vscode/launch.json: Language not supported
- src/class-tiny-compress-client.php: Language not supported
- src/class-tiny-compress-fopen.php: Language not supported
- src/class-tiny-compress.php: Language not supported
- src/class-tiny-helpers.php: Language not supported
- src/class-tiny-image-size.php: Language not supported
- src/class-tiny-image.php: Language not supported
- src/class-tiny-picture.php: Language not supported
- src/class-tiny-plugin.php: Language not supported
- src/class-tiny-settings.php: Language not supported
- src/config/class-tiny-config.php: Language not supported
- src/css/admin.css: Language not supported
- src/views/compress-details.php: Language not supported
- src/views/settings.php: Language not supported
- test/helpers/mock-http-stream-wrapper.php: Language not supported
- test/helpers/mock-tinify-client.php: Language not supported
- test/helpers/wordpress.php: Language not supported
src/class-tiny-bulk-optimization.php
Outdated
$stats['optimized-image-sizes'] += $image_stats['image_sizes_optimized']; | ||
$stats['optimized-library-size'] += $image_stats['optimized_total_size']; | ||
if ( $conversion_enabled ) { | ||
$stats['available-unoptimised-sizes'] += |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it sucks to change it later, stick with one spelling (optimized)
With file conversion enabled customers can choose to generate an additional image in a modern format. WebP and AVIF are known to produce a better quality and performance image. Unfortunately, not all browsers support it 100% so therefor we choose to supply it as an addition instead of replacing the image.
Screenshots
Conversion is (for now) enabled by default. It will cost one additional compression per image.
We show the optimized file and the size in the details tab.
Further Improvements
Below are options/features that can be added to this feature. Discussion is open to see if these are all could haves or if some of them are must haves.