• Ced

    (@cedriccharles)


    Hi!

    First of all, thank you for your great plugin that I use on multiple websites without any issue.

    Yesterday I’ve tried to install it on a client server (not the servers we usually used). First, iMagick was installed but without WEBP support. I’ve asked my client to activate WEBP support with iMagick. Now I have this in my settings page: https://snag.gy/5fgnyA.jpg. Both “test” are working. But when I try to “bulk convert” existing files, I have this: https://snag.gy/STLVzF.jpg.

    In my debug files, I have these errors:
    [17-May-2019 07:31:54 UTC] PHP Warning: Invalid argument supplied for foreach() in /wp-content/plugins/webp-express/vendor/rosell-dk/webp-convert/src/Converters/ConverterHelper.php on line 181

    Could you please help?

    Thank you in advance ?? !

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author rosell.dk

    (@roselldk)

    Thanks for the bug report!

    You can try deactivating cwebp and see if it starts working.

    But the error indicates that the configuration file is invalid (it is generated when you save options in WebP Express). Can you post wp-content/webp-express/wod-options.json here? and also wp-content/webp-express/config.json – thanks!

    • This reply was modified 5 years, 10 months ago by rosell.dk.
    Thread Starter Ced

    (@cedriccharles)

    Hi and thanks for that quick answer ?? !

    Even with cwebp deactivated, it doesn’t work.

    Here are the files you asked for:

    WOD-OPTIONS.JSON:
    {
    “destination-folder”: “separate”,
    “destination-extension”: “append”,
    “forward-query-string”: true,
    “converters”: [
    {
    “converter”: “imagickbinary”,
    “options”: {
    “use-nice”: true
    }
    },
    {
    “converter”: “cwebp”,
    “options”: {
    “use-nice”: true,
    “try-common-system-paths”: true,
    “try-supplied-binary-for-os”: true,
    “method”: 6,
    “low-memory”: false,
    “command-line-options”: “-low_memory”
    }
    }
    ],
    “metadata”: “none”,
    “fail”: “original”,
    “success-response”: “converted”,
    “base-htaccess-on-these-capability-tests”: {
    “passThroughHeaderWorking”: false,
    “passThroughEnvWorking”: false,
    “modHeaderWorking”: false
    },
    “cache-control-header”: “”,
    “quality”: 85,
    “paths”: {
    “uploadDirRel”: “wp-content/uploads”
    }
    }

    CONFIG.JSON
    {
    “operation-mode”: “varied-image-responses”,
    “image-types”: 3,
    “destination-folder”: “separate”,
    “destination-extension”: “append”,
    “cache-control”: “no-header”,
    “cache-control-custom”: “public, max-age=31536000, stale-while-revalidate=604800, stale-if-error=604800”,
    “cache-control-max-age”: “one-week”,
    “cache-control-public”: false,
    “enable-redirection-to-converter”: true,
    “only-redirect-to-converter-on-cache-miss”: false,
    “only-redirect-to-converter-for-webp-enabled-browsers”: true,
    “do-not-pass-source-in-query-string”: true,
    “redirect-to-existing-in-htaccess”: true,
    “forward-query-string”: true,
    “enable-redirection-to-webp-realizer”: true,
    “converters”: [
    {
    “converter”: “imagickbinary”,
    “options”: {
    “use-nice”: true
    },
    “working”: true
    },
    {
    “converter”: “cwebp”,
    “options”: {
    “use-nice”: true,
    “try-common-system-paths”: true,
    “try-supplied-binary-for-os”: true,
    “method”: 6,
    “size-in-percentage”: 45,
    “low-memory”: false,
    “command-line-options”: “-low_memory”,
    “set-size”: false
    },
    “working”: true
    },
    {
    “converter”: “gd”,
    “options”: {
    “skip-pngs”: false
    },
    “working”: false,
    “error”: “Required imagewebp() function is not available. It seems Gd has been compiled without webp support.”,
    “deactivated”: true
    },
    {
    “converter”: “imagick”,
    “deactivated”: true,
    “working”: false,
    “error”: “iMagick was compiled without WebP support.”
    },
    {
    “converter”: “gmagick”,
    “deactivated”: true,
    “working”: false,
    “error”: “Required Gmagick extension is not available.”
    },
    {
    “converter”: “wpc”,
    “deactivated”: true,
    “working”: false,
    “error”: “Not configured”,
    “options”: {
    “api-key”: “”
    }
    },
    {
    “converter”: “ewww”,
    “deactivated”: true,
    “working”: false,
    “error”: “Missing API key.”
    }
    ],
    “quality-auto”: false,
    “max-quality”: 80,
    “quality-specific”: 85,
    “metadata”: “none”,
    “convert-on-upload”: true,
    “fail”: “original”,
    “success-response”: “converted”,
    “alter-html”: {
    “enabled”: false,
    “only-for-webp-enabled-browsers”: false,
    “alter-html-add-picturefill-js”: true,
    “only-for-webps-that-exists”: false,
    “replacement”: “picture”,
    “hooks”: “ob”
    },
    “web-service”: {
    “enabled”: false,
    “whitelist”: []
    },
    “base-htaccess-on-these-capability-tests”: {
    “passThroughHeaderWorking”: false,
    “passThroughEnvWorking”: false,
    “modHeaderWorking”: false
    },
    “paths-used-in-htaccess”: {
    “existing”: “wp-content/webp-express/webp-images/doc-root/.”,
    “wod-url-path”: “wp-content/plugins/webp-express/wod/webp-on-demand.php”,
    “config-dir-rel”: “wp-content/webp-express/config”
    }
    }

    Thank you !

    Plugin Author rosell.dk

    (@roselldk)

    hm, options looks fine, actually. I’m thinking that perhaps the options aren’t passed correctly to webp convert. The passing happens in plugins/webp-express/wod/webp-on-demand.php. Before debugging this file, however, try to add ?debug after an image url. This should trigger delivering a report instead of an image.

    Thread Starter Ced

    (@cedriccharles)

    Hi!

    ?debug at the end of an image url just displays the image for me :s

    Plugin Author rosell.dk

    (@roselldk)

    Ok, you are probably in “CDN friendly” mode. Anyway, I wasn’t thinking. The Bulk conversion does not pass the option through webp-on-demand.php. The action rather happens in lib/classes/BulkConvert.php and lib/classes/Convert.php. I’m going to have to wait for this till after the weekend. But you could try to add debug lib/classes/Convert.php. For example, try to see if $config contains the config file in the beginning of the convertFile() function. You can write to the error-log with the error_log() function. And serialize $config with print_r($config, true);. Combined: error_log(print_r($config, true));

    • This reply was modified 5 years, 10 months ago by rosell.dk.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Invalid argument supplied foreach()’ is closed to new replies.