-
Notifications
You must be signed in to change notification settings - Fork 143
Disabling "Also output JPEG" does not prevent picture element from being served #1375
Copy link
Copy link
Closed
Labels
Good First IssueIssue particularly suitable to be worked on by new contributorsIssue particularly suitable to be worked on by new contributors[Plugin] Modern Image FormatsIssues for the Modern Image Formats plugin (formerly WebP Uploads)Issues for the Modern Image Formats plugin (formerly WebP Uploads)[Type] BugAn existing feature is brokenAn existing feature is broken
Milestone
Description
Bug Description
I had "Also output JPEG" and "Picture element" enabled. Then I tried turning off "Also output JPEG" and I then uploaded an image. I then unexpectedly got the picture element served, with the img and the source both being the AVIF image:
<picture class="not-transparent wp-picture-76" style="--dominant-color: #749872; display: contents;">
<source type="image/avif" srcset="http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-1024x588.avif 1024w, http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-300x172.avif 300w, http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-768x441.avif 768w" sizes="(max-width: 1024px) 100vw, 1024px">
<img data-dominant-color="749872" data-has-transparency="false" fetchpriority="high" decoding="async" width="1024" height="588" src="http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-1024x588.avif" alt="" class="not-transparent wp-image-76" srcset="http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-1024x588.avif 1024w, http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-300x172.avif 300w, http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-768x441.avif 768w, http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-1536x882.avif 1536w, http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-2048x1176.avif 2048w, http://localhost:8888/wp-content/uploads/2024/07/Samango_monkey_Cercopithecus_mitis_erythrarchus_Mount_Sheba-1-1568x901.avif 1568w" sizes="(max-width: 1024px) 100vw, 1024px">
</picture>This is wrong. The webp_uploads_is_picture_element_enabled() function:
performance/plugins/webp-uploads/helper.php
Lines 395 to 397 in d4cc524
| function webp_uploads_is_picture_element_enabled(): bool { | |
| return (bool) get_option( 'webp_uploads_use_picture_element', false ); | |
| } |
Should be changed to:
function webp_uploads_is_picture_element_enabled(): bool {
return webp_uploads_is_jpeg_fallback_enabled() && (bool) get_option( 'webp_uploads_use_picture_element', false );
}Screenshots
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Good First IssueIssue particularly suitable to be worked on by new contributorsIssue particularly suitable to be worked on by new contributors[Plugin] Modern Image FormatsIssues for the Modern Image Formats plugin (formerly WebP Uploads)Issues for the Modern Image Formats plugin (formerly WebP Uploads)[Type] BugAn existing feature is brokenAn existing feature is broken
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Done 😃
