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

Enable webp/avif support for images outputed with wp_get_attachment_image #138

Open
matthewgrzegorczyk opened this issue May 27, 2024 · 1 comment

Comments

@matthewgrzegorczyk
Copy link

matthewgrzegorczyk commented May 27, 2024

Shorptixel version: 5.6.2

I am trying to use webp/avif compression on the page, but as the site is custom build app on roots/bedrock I had to fix several things as the option of delivering next gen image formats via picture tag using wordpres hook didn't work out of the box.

image

I've notice that in the FrontController the replacement of <img> tag with <picture> tag happens only for the_content, the_excerpt and post_thumbnail_html.
Is it possible that we add in here: https://github.com/short-pixel-optimizer/shortpixel-image-optimiser/blob/master/class/Controller/FrontController.php#L46
another option to run convertImgToPictureAddWebp?
add_filter('wp_get_attachment_image', array($this, 'convertImgToPictureAddWebp'), 10, 4);

If not, maybe it's possible to add do_action hook which would enable advanded users to register it on their own?
do_action('shortpixel/init_webp_hooks', $this, $webp_option)

@matthewgrzegorczyk
Copy link
Author

@pdobrescu Did you had a chance to check the issue I am describing above?

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

1 participant