Skip to content
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

Reconsider adding WebP support #72

Open
cessez-le-feu opened this issue Sep 12, 2021 · 2 comments
Open

Reconsider adding WebP support #72

cessez-le-feu opened this issue Sep 12, 2021 · 2 comments

Comments

@cessez-le-feu
Copy link

Hello,

I think you should reconsider adding WebP support. The original ticket proposing WebP support was closed for the reason that, at the time, WordPress core didn’t allow WebP by default, and only one browser understood the format. However, the situation has completely changed since. See:

And actually, updating the "wp-featherlight" plugin to support WebP would be a child’s game. For my own site, I just replaced all occurrences of "bmp" with "webp" in the plugin’s code, and it worked!

@jcamp
Copy link

jcamp commented Oct 14, 2022

Just update "wpFeatherlight.js" and add "WebP" to the list of image types.

This function is in several places:

/**
	 * Checks href targets to see if a given anchor is linking to an image.
	 *
	 * @since  0.1.0
	 * @return mixed
	 */
	function testImages( index, element ) {
		return /(.png|.jpg|.jpeg|.gif|.tiff|.bmp|.webp)$/.test(
			$( element ).attr( 'href' ).toLowerCase().split( '?' )[0].split( '#' )[0]
		);
	}

Present in 3 files

js/wpFeatherlight.js
function testImages( index, element ) {

assets/plugin/js/wpFeatherlight.js
function testImages( index, element ) {

js/wpFeatherlight.pkgd.js
function testImages( index, element ) {

@Azragh
Copy link

Azragh commented Feb 8, 2023

#74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants