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

WebP support missing #2714

Closed
KennethJoris opened this issue Oct 30, 2019 · 3 comments
Closed

WebP support missing #2714

KennethJoris opened this issue Oct 30, 2019 · 3 comments

Comments

@KennethJoris
Copy link

KennethJoris commented Oct 30, 2019

webp image format is supported by most main browsers now. Caniuse

Will Grav add support any soon?

Related to an old request from 2016 #1168

@rhukster
Copy link
Member

We currently have the same issue as #1168 - we are locked into a specific image library in Grav 1.x, and it doesn't support WebP. With Grav 2.x we plan on revisiting this and updating to a more flexible library.

@KennethJoris
Copy link
Author

KennethJoris commented Oct 31, 2019

For future reference:
In your .htaccess file you can check for WebP support and switch to this format if supported :)

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
    RewriteRule ^(path/to/your/images.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>

<IfModule mod_headers.c>
    Header append Vary Accept env=REDIRECT_accept
</IfModule>

AddType image/webp .webp

@hdwebpros
Copy link

@rhukster With this post does this mean GD supports what we need here?
https://www.php.net/manual/en/function.imagewebp.php

If not, I found another post mentioning install libwebp-devel will work in GD.

php -r 'var_dump(gd_info());'
array(12) {
  ["GD Version"]=>
  string(26) "bundled (2.1.0 compatible)"
  ["FreeType Support"]=>
  bool(true)
  ["FreeType Linkage"]=>
  string(13) "with freetype"
  ["GIF Read Support"]=>
  bool(true)
  ["GIF Create Support"]=>
  bool(true)
  ["JPEG Support"]=>
  bool(true)
  ["PNG Support"]=>
  bool(true)
  ["WBMP Support"]=>
  bool(true)
  ["XPM Support"]=>
  bool(false)
  ["XBM Support"]=>
  bool(true)
  ["WebP Support"]=>
  bool(true)
  ["JIS-mapped Japanese Font Support"]=>
  bool(false)
}

Does this provide enough hope that we can start looking at trying to get WebP to work in GD? I'd be willing to provide a little company time towards this, but I want to spend that time wisely

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

No branches or pull requests

3 participants