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.

git-svn-id: https://develop.svn.wordpress.org/trunk@53451 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-05-30 14:52:00 +00:00
parent a53b828af9
commit 91dc2d1b42

View File

@@ -76,10 +76,16 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
baseURL = url;
}
var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$|\.webp$/;
var urlType = baseURL.toLowerCase().match(urlString);
if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
if(urlType == '.jpg' ||
urlType == '.jpeg' ||
urlType == '.png' ||
urlType == '.gif' ||
urlType == '.bmp' ||
urlType == '.webp'
){//code to show images
TB_PrevCaption = "";
TB_PrevURL = "";