Make WordPress Core

Changeset 53451


Ignore:
Timestamp:
05/30/2022 02:52:00 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Media: Add support for WebP images in the Thickbox library.

This ensures that .webp images are properly recognized and displayed in the modal as expected.

Follow-up to [50810], [51227], [52073].

Props ilunabar, graham73may, sabernhardt, mukesh27, SergeyBiryukov.
Fixes #55786.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/vendor/thickbox/thickbox.js

    r50410 r53451  
    7777       }
    7878
    79        var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
     79       var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$|\.webp$/;
    8080       var urlType = baseURL.toLowerCase().match(urlString);
    8181
    82         if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
     82        if(urlType == '.jpg' ||
     83            urlType == '.jpeg' ||
     84            urlType == '.png' ||
     85            urlType == '.gif' ||
     86            urlType == '.bmp' ||
     87            urlType == '.webp'
     88        ){//code to show images
    8389
    8490            TB_PrevCaption = "";
Note: See TracChangeset for help on using the changeset viewer.