如何在Lightbox中使用WebP图像?

通过$instance="WIN2016-SQL01\SQLSERVER_01" $database = "AdventureWorks2014" $query1 = "SELECT TOP 10 [BusinessEntityID] FROM [AdventureWorks2014].[Person].[BusinessEntityAddress] where BusinessEntityID < 10 order by 1 " $Q1 = (invoke-sqlcmd -query $query1 -ServerInstance $instance -Database $database) $query2 = "SELECT * FROM [AdventureWorks2014].[Person].[Person] where BusinessEntityID in ($Q1)" $Q2 = invoke-sqlcmd -query $query2 -ServerInstance $instance -Database $database 标签使用WebP图像是加快大多数浏览器网络访问速度的好方法。我可以在Lightbox中执行相同的操作,但仅是缩略图。

<picture>

是否有办法使用WebP图像甚至用于单击时显示的图像(在通过锚点的<a href="some_img.jpg" data-lightbox="reference"> <picture> <source srcset="some_img.webp" type="image/webp"> <img src="some_img.jpg"alt=""> </picture> </a> 设置的灯箱中)?

itxfdnaaa 回答:如何在Lightbox中使用WebP图像?

以下与wordpress有关-我正在使用WebP Express插件-该服务将webp图像作为jpg的扩展,即“ myimage.jpg.webp”,我猜想灯箱可以通过简单地添加来为图像提供图像.webp”到某处的js代码

*更新似乎有可能-我可以通过将照片中的自定义网址更改为.webp版本来使灯箱打开webp照片

问题仍然是基于浏览器兼容性,找出在lightbook中分别打开.jpg或.webp的方法

,

发现了这个线程,表明swipebox灯箱与webp兼容

https://wordpress.org/support/topic/support-webp-images/

也许您可以类似地修改现有的灯箱代码:

添加webp只是一个简单的更改–只需在lightbox-photoswipe.php的第235行中添加扩展名即可:

OLD:

if (in_array($type['ext'],array('jpg','jpeg','jpe','gif','png','bmp','tif','tiff','ico'))) {

新:

if (in_array($type['ext'],'ico','webp'))) {

screenshot

本文链接:https://www.f2er.com/2747131.html

大家都在问