Hm… The javascript makes a request to get list of unconverted files. It should be a JSON formatted object, however, for some reason, it is not.
I wonder what it is, then!
Can you help me out with a little debugging?
1: Open file: plugins/webp-express/lib/options/js/0.16.0/bulk-convert.js
2: In line 11-12, you should se this code:
jQuery.post(ajaxurl, data, function(response) {
if ((typeof response == 'object') && (response['success'] == false)) {
Between those two lines, insert this code:
var responseObj;
try {
responseObj = JSON.parse(response);
} catch (e) {
html = '<h1>Error</h1>';
html += '<p>The ajax call did not return valid JSON, as expected.</p>';
html += '<p>Check the javascript console to see what was returned.</p>';
console.log('The ajax call did not return valid JSON, as expected');
console.log('Here is what was received:');
console.log(response);
document.getElementById('bulkconvertcontent').innerHTML = html;
return;
}
Next, reload the WebP Express settings page and click “Bulk Convert”. I expect that you now see an error message, which directs you to look at the console output.
Please copy the console output and paste it here, thanks!
Hi there,
thank you for your answer.
I did that you said. This is my console output:
“The ajax call did not return valid JSON, as expected
bulk-convert.js?ver=2:20 Here is what was received:
Here the screenshot https://i.imgur.com/tI3NweQ.png
It is probably still on the cached version.
in plugins/webp-express/lib/options/enqueue_scripts.php, line 7, you can change this line:
$ver = '6';
to:
$ver = '7';
This should force it to use the changed file
It was on ” $ver = ‘2’; ” and i put $ver = ‘7’; but nothing happened.
View post on imgur.com
Any idea?
Thanks so much for your quick support.
Have you tried hitting F5 / ctrl+F5 to force refresh? https://refreshyourcache.com/en/cache/
Oh, did you change the screendump, or did I read it wrong the first time?
The new code IS running. It shows that the server simply returned an empty string.
Try to open the “Network” tab in DevTools (two tabs to the right of “Console”). You should see a request to “admin_ajax.php”, probably several. To get the right one, clear the console (the red button) and then click “Bulk Convert”. Doing so should produce a request to “admin_ajax.php”. Then click the on “admin_ajax.php” and select the “Response” tab. Is it empty too?
-
This reply was modified 5 years, 9 months ago by
rosell.dk.
I force the refresh but nothing happen, same error.
Can i give you access to the website?
Oh, yeah, that would be the easiest way for me to find the error. Thanks π My email is [email protected]
I only have 15 minutes more today, but I can continue tomorrow.
Great, thank you. I hope you can find the problem.
Found it. Finally!
The problem was special characters in some of the files. I have fixed it on your installation. It now gets the list. It still fails the individual files which have special characters (including the two first files)
More technically, the problem was that json_encode failed because the object contained non-unicode strings. All string data must be UTF-8 encoded before calling json_encode, as the docs says. The fix was to use utf8_encode() on the filenames.
The fix has not been released yet.
I created an issue for this issue on github:
https://github.com/rosell-dk/webp-express/issues/445