• Resolved gabrielenet93

    (@gabrielenet93)


    Hi there,
    why when i try to make a mass conversion of the images nothing happens and everything remains blocked in the data collection screen?

    I tried to disable plugins and change themes but the problem persists. The site has about 4000 images.
    Theme: Divi
    Url clone all plugin disabled: pasiniclone.netenjoy.dev/wp
    Url original: pasini.netenjoy.dev/wp

    ——— Console errors
    Uncaught SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.success (bulk-convert.js?ver=2:21)
    at i (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4.2:2)
    at Object.fireWith [as resolveWith] (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4.2:2)
    at x (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4.2:4)
    at XMLHttpRequest.c (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4.2:4)

Viewing 15 replies - 1 through 15 (of 19 total)
  • Thread Starter gabrielenet93

    (@gabrielenet93)

    Someone can help me?

    Plugin Author rosell.dk

    (@roselldk)

    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!

    Thread Starter gabrielenet93

    (@gabrielenet93)

    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

    • This reply was modified 4 years, 3 months ago by gabrielenet93.
    Plugin Author rosell.dk

    (@roselldk)

    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

    Thread Starter gabrielenet93

    (@gabrielenet93)

    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.

    Plugin Author rosell.dk

    (@roselldk)

    Have you tried hitting F5 / ctrl+F5 to force refresh? https://refreshyourcache.com/en/cache/

    Plugin Author rosell.dk

    (@roselldk)

    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.

    Plugin Author rosell.dk

    (@roselldk)

    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 4 years, 3 months ago by rosell.dk.
    Thread Starter gabrielenet93

    (@gabrielenet93)

    I force the refresh but nothing happen, same error.
    Can i give you access to the website?

    Plugin Author rosell.dk

    (@roselldk)

    Oh, yeah, that would be the easiest way for me to find the error. Thanks ?? My email is [email protected]

    Plugin Author rosell.dk

    (@roselldk)

    I only have 15 minutes more today, but I can continue tomorrow.

    Plugin Author rosell.dk

    (@roselldk)

    I got the login, thanks

    Thread Starter gabrielenet93

    (@gabrielenet93)

    Great, thank you. I hope you can find the problem.

    Plugin Author rosell.dk

    (@roselldk)

    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)

    Plugin Author rosell.dk

    (@roselldk)

    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

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Can’t bulk convert image’ is closed to new replies.