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 issues with EDIT ME plugin. #70

Open
TastySoul opened this issue Oct 12, 2020 · 6 comments
Open

Webp issues with EDIT ME plugin. #70

TastySoul opened this issue Oct 12, 2020 · 6 comments

Comments

@TastySoul
Copy link

Hi
I get error when uploading images from frontend with enabled webp conversion. I quess it's rewriting upload path or messing with upload verification.
Wouldnt it be better to detect support in plugin and change picture based on that ?

if( strpos( $_SERVER['HTTP_ACCEPT'], 'image/webp' ) == true ) {
    // webp is supported!
}
@tobias-kuendig
Copy link
Member

I'll need some more info to help you here.

What error do you get? How do you upload the image? The plugin only rewrites requested images to their webp version. If the webp version does not exist, it tries to convert the original image to the webp format.

The plugin should not interfere wit your uploads.

Having the webp check server side would mean that every image that gets requested needs to be handled by PHP. This would result in a huge performance issue.

@TastySoul
Copy link
Author

image
Sadly there is not much more i can provide. Should be pretty easy to recreate.
It's uploaded from frontend.
I think its trying to verify image but it gets redirected.

@tobias-kuendig
Copy link
Member

Check out the network tab and see what the server returns. Maybe there is some additional information. Also, check your storage/logs/system.log file.

@TastySoul
Copy link
Author

image
Not much info returned just 404.
System log has no info at all.

@TastySoul
Copy link
Author

TastySoul commented Oct 12, 2020

Another idea for solution. What about using picture tag ? And automatically attach webp to it.
Would get rid of htaccess.

<picture>
  <source srcset="img/awesomeWebPImage.webp" type="image/webp">
  <img src="img/creakyOldJPEG.jpg" alt="Alt Text!">
</picture>

@tobias-kuendig
Copy link
Member

But then you would have to rewrite the markup of the page. And there is a big difference between a picture and a single img tag, this will break people's websites if it is applied automatically.

There's nothing stopping you from using the picture element manually. You can edit the .htaccess rules to your needs. All they do is redirect an image to the webp.php helper so it gets converted automatically.

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

2 participants