Support » Plugin: WebP Express » Does not convert

  • sighan

    (@sighan)


    How do I set it up to actually convert images?.

    My Settings are as follows:

    CDN Friendly Mode

    Alter HTML
    Replace Image URLs
    Reference webps that hasn’t been converted yet

    Convert non-existing webp-files upon request
    Convert non-existing webp-files upon request to original image

    I tested all converters and only one (GD Extension) passes the test to begin with (which I get).

    The URL Replacement seems to work fine, however the images are never actually generated, the /wp-content/webp-express/webp-images/ folder is completely empty except for the one test conversion.

    Also, as many other users have mentioned, the media library is broken with this plugin active, not sure why that happens.

    How would I have to set it up so the plugin starts converting images? Right now all it is doing is giving 404 on all images as well as breaking the media library.

    Kind regards
    Daniel

    • This topic was modified 9 months ago by  sighan.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Brad Johnson

    (@p4fbradjohnson)

    If you are on NGINX you need to add the correct rules. (Its in the FAQ)

    Which webserver do you use?

    Plugin Author rosell.dk

    (@roselldk)

    The media library bug has been fixed in 0.11.3.

    The .htaccess rules can either be placed in .htaccess located in root or in wp-content. In 0.11.2, the “Convert non-existing webp-files upon request” option did not work when rules were placed in root because of conflicting WordPress rules. WordPress “took the” request before WebP Express could. The solution was to move the WebP Express rules above the WordPress rules. Actually, the problem persists in 0.11.3, but in 0.11.3, you are informed when the problem occurs, and on how to resolve

    Plugin Author rosell.dk

    (@roselldk)

    It may be that the hocus-pocus I created to transfer the file path of the file to be converted to the script without passing it in query string isn’t working on your server setup. Transferring the file path in query string can give problems with firewalls, so I created .htaccess rules to transfer it in environment variables and request header instead. However, evidence is showing that it does not work on all servers. In that case, you should disable the “Do not pass source in Query String” option. It is only available in “Tweaked” mode (it is implicitly enabled in the other modes). It only has affect on the redirection to the converter (wod/webp-on-demand.php). I haven’t implemented transfer in query string for the “Convert non-existing webp-files upon request” feature (wod/webp-realizer.php), as it at the time seemed it wasn’t needed.

    Plugin Author rosell.dk

    (@roselldk)

    0.12 is out now. I have done some fixes. Perhaps it works now ?

    Hey,

    I have tried the latest version, it is still not working for me.

    However I can’t even test if it is converting, as the plugin is not getting that far. I have enabled “Alter Html”, with it replacing the urls instead of the tags.

    When I try to do that using the hooks, nothing happens, but I’m using betheme and I’m not too sure if they even use the content, so maybe that’s the problem.

    However when I try to use the output buffering it just crashes the entire site.

    This is the error:

    
    [06-Mar-2019 14:31:41 UTC] PHP Fatal error:  Uncaught Error: Call to a member function find() on boolean in 
    projectname/wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php:161
    Stack trace:
    #0 
    projectname/wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php(200): DOMUtilForWebP\ImageUrlReplacer->replaceHtml('<!DOCTYPE html>...')
    #1 
    projectname/wp-content/plugins/webp-express/lib/classes/AlterHtmlInit.php(57): DOMUtilForWebP\ImageUrlReplacer::replace('<!DOCTYPE html>...')
    #2 [internal function]: WebPExpress\AlterHtmlInit::alterHtml('<!DOCTYPE html>...', 9)
    #3 
    projectname/wp-includes/functions.php(3778): ob_end_flush()
    #4 
    projectname/wp-includes/class-wp-hook.php(286): wp_ob_end_flush_all('')
    #5 
    projectname/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
    #6 /Us in 
    projectname/wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php on line 161
    [06-Mar-2019 14:31:41 UTC] PHP Fatal error:  Uncaught Error: Call to a member function find() on boolean in 
    projectname/wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php:161
    Stack trace:
    #0 
    projectname/wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php(200): DOMUtilForWebP\ImageUrlReplacer->replaceHtml('<!DOCTYPE html>...')
    #1 
    projectname/wp-content/plugins/webp-express/lib/classes/AlterHtmlInit.php(57): DOMUtilForWebP\ImageUrlReplacer::replace('<!DOCTYPE html>...')
    #2 [internal function]: WebPExpress\AlterHtmlInit::alterHtml('<!DOCTYPE html>...', 9)
    #3 {main}
      thrown in 
    projectname/wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php on line 161
    

    When I run it without “Alter HTML” no changes occur on the page, which makes sense. When I now manually set an image source to webp (and set up webp express to work accordingly (files mingled, not in a seperate folder, and webp instead of jpg, not after it), no webp file gets created. Not sure if that’s because the converter doesn’t work, or because the plugin doesn’t recognize a webp file being requested.

    I am using nginx, and as you noted I would probably have to change some server settings, however with no access to them that’s not really an option.

    I would find that much more acceptable however if the gd converter in the settings wouldn’t display a big green check, and when I run the test it tells me it worked. However that is the only time the converter “works”, leading me to believe that this test is never really run and we are seeing some preset.

    If the converter doesn’t work with my configuration fine, but leading me to believer that it does when really it isn’t functional at all is just awful and I would strongly suggest you look into that.

    If the converter is actually working and the images are not being created due to some other reason, maybe a way to manually start the conversion of the images could be implemented. That would at the very least help nail down the problem.

    Kind regards
    Daniel

    • This reply was modified 8 months, 1 week ago by  sighan.
    Plugin Author rosell.dk

    (@roselldk)

    Hi Daniel,

    Thanks for reporting the bug and publishing the stack-trace. That is very helpful.

    I’m using a library called “simple_html_dom” for parsing the HTML. I wasn’t aware that it in some cases returns “false” rather than an object. Diving into their code, I see that this happens when the HTML is bigger than 600 kb or empty. It is possible to increase the limit with by setting the MAX_FILE_SIZE constant. It is probably a good idea to have some upper limit, though. I guess I shall keep it at 600 kb and simply not touch the HTML when it is too big. Perhaps insert a HTML comment in the top saying that the HTML was too big to be processed.

    Regarding webp creation, of course, the test is not some kind of dummy. If the test succeeds, you should also be able to locate the generated webp in the file system. I agree that it would be really awful to cheat with the tests!

    The problem is with TRIGGERING the conversion. Triggering it currently requires functional redirection. That is simply the only way, right now. So without Nginx redirection rules, you get no conversion. I’m aware that a bulk conversion button would be great, and it is not too far away on the roadmap.

    Plugin Author rosell.dk

    (@roselldk)

    Btw: I use “simple_html_dom” on the complete HTML when replacing image urls. I however only use it to parse attributes on HTML elements when replacing picture tags. So if you switch to using picture tag syntax, you should not get that failure

    Plugin Author rosell.dk

    (@roselldk)

    Actually what we have here is an argument to also only parse bits of HTML with image urls. I have already considered doing that (https://github.com/rosell-dk/dom-util-for-webp/issues/5)

    Plugin Author rosell.dk

    (@roselldk)

    The bug in Alter HTML has been fixed in 0.12.1.

    https://github.com/rosell-dk/dom-util-for-webp/issues/11

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Does not convert’ is closed to new replies.