Discover Centmin Mod today
Register Now

WebP Configuration, No WebP Images

Discussion in 'Web Development & Web Performance' started by Mrbo, Feb 27, 2019.

  1. Mrbo

    Mrbo Member

    97
    7
    8
    Jun 17, 2018
    Ratings:
    +7
    Local Time:
    5:37 AM
    I tried to follow this guide, but I think I missed something because I dont get any WebP files. I got through the whole process just fine without any errors, but as I mentioned, no WebP images.

    I installed optimise-images.sh and added the config to vhost. Do I need to run any command after that for it to take effect on the vhost?

    I ran this command in the terminal in cd optimise-images. Do I need to run it in any other way? Do I need to add / at the end of uploads?
    wp_upload_dir='/home/nginx/domains/mydomain.com/public/wp-content/uploads'
     
  2. eva2000

    eva2000 Administrator Staff Member

    39,199
    8,654
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,307
    Local Time:
    8:37 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    everything after sentence
    is run from SSH command line to proceed with actual optimise-images.sh run for optimising images

    so you need to run

    set wp_upload_dir variable to point to your Centmin Mod wordpress install's upload directory
    Code (Text):
    wp_upload_dir='/home/nginx/domains/domain.com/public/wp-content/uploads'
    

    Then run this find command to go through 2nd level directories under /uploads and run optimise-images.sh profile mode
    Code (Text):
    find $wp_upload_dir -maxdepth 2 -mindepth 2 -type d | grep -E '[0-9]{4}' | sort | while read d; do if [[ "$(ls -Al $d | head -n1 | grep -o 'total 0')" != 'total 0' ]]; then echo "profile directory: $d"; echo "/root/tools/optimise-images/optimise-images.sh profile $d"; /root/tools/optimise-images/optimise-images.sh profile $d; fi; done
    

    Next run optimise-images.sh optimise-cron mode to begin optimising and doing WebP conversions
    Code (Text):
    find $wp_upload_dir -maxdepth 2 -mindepth 2 -type d | grep -E '[0-9]{4}' | sort | while read d; do if [[ "$(ls -Al $d | head -n1 | grep -o 'total 0')" != 'total 0' ]]; then echo "optimise directory: $d"; echo "/root/tools/optimise-images/optimise-images.sh optimise-cron $d"; /root/tools/optimise-images/optimise-images.sh optimise-cron $d; chown -R nginx:nginx $d; fi; done
    
     
    • Like Like x 1
  3. Mrbo

    Mrbo Member

    97
    7
    8
    Jun 17, 2018
    Ratings:
    +7
    Local Time:
    5:37 AM
    I did exactly that. I think I found part of the problem.
    It only converted images in this folder and no other folder:
    /home/nginx/domains/mydomain.com/public/wp-content/uploads/elements/
     
  4. eva2000

    eva2000 Administrator Staff Member

    39,199
    8,654
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,307
    Local Time:
    8:37 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    those commands look for /upload directories of specific name format so what's output for
    Code (Text):
    wp_upload_dir='/home/nginx/domains/domain.com/public/wp-content/uploads'
    find $wp_upload_dir -maxdepth 2 -mindepth 2 -type d
    

    and
    Code (Text):
    wp_upload_dir='/home/nginx/domains/domain.com/public/wp-content/uploads'
    find $wp_upload_dir -maxdepth 2 -mindepth 2 -type d | grep -E '[0-9]{4}' | sort
    
     
  5. Mrbo

    Mrbo Member

    97
    7
    8
    Jun 17, 2018
    Ratings:
    +7
    Local Time:
    5:37 AM
    Code:
    [23:29][[email protected] optimise-images]# wp_upload_dir='/home/nginx/domains/webdigitos.com/public/wp-content/uploads'
    [23:29][[email protected] optimise-images]# find $wp_upload_dir -maxdepth 2 -mindepth 2 -type d
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/mainwp/backup
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/ithemes-security/backups
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/ithemes-security/logs
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/ithemes-security/maxmind
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elementor/thumbs
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elementor/css
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/2019/01
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-40-1550819617
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-18-1548864660
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-260-1548869595
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-24-1550055994
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-6-1548864851
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-109-1548864717
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-43-1551194438
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-20-1548864828
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-5-1551187340
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-5-1551187104
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-15-1548869420
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-5-1551187143
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-30-1548870230
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-217-1548864987
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-10-1548864726
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-40-1550744490
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-35-1548870815
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-511-1548869473
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-5-1551187274
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-31-1548864709
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-29-1548864794
    
    and

    Code:
    [23:29][[email protected] optimise-images]# wp_upload_dir='/home/nginx/domains/webdigitos.com/public/wp-content/uploads'
    [23:30][[email protected] optimise-images]# find $wp_upload_dir -maxdepth 2 -mindepth 2 -type d | grep -E '[0-9]{4}' | sort
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/2019/01
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-10-1548864726
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-109-1548864717
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-15-1548869420
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-18-1548864660
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-20-1548864828
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-217-1548864987
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-24-1550055994
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-260-1548869595
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-29-1548864794
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-30-1548870230
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-31-1548864709
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-35-1548870815
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-40-1550744490
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-40-1550819617
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-43-1551194438
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-511-1548869473
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-5-1551187104
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-5-1551187143
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-5-1551187274
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-5-1551187340
    /home/nginx/domains/webdigitos.com/public/wp-content/uploads/elements/template-6-1548864851
    
    And no images converted in root uploads folder.
     
  6. eva2000

    eva2000 Administrator Staff Member

    39,199
    8,654
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,307
    Local Time:
    8:37 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    that's by design, those commands are only looking into /uploads/ subdirectories from the 2nd command you posted output

    if you want to run against /uploads directory just run the optimise-images.sh against that directory itself
     
    • Like Like x 1
  7. Mrbo

    Mrbo Member

    97
    7
    8
    Jun 17, 2018
    Ratings:
    +7
    Local Time:
    5:37 AM
    Now I get it. Great, thanks!
     
  8. Mrbo

    Mrbo Member

    97
    7
    8
    Jun 17, 2018
    Ratings:
    +7
    Local Time:
    5:37 AM
    If I set mindepth 0, will it then convert and optimize the root folder as well so I don't have to run multiple jobs for different levels?
     
  9. eva2000

    eva2000 Administrator Staff Member

    39,199
    8,654
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,307
    Local Time:
    8:37 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    you can always do tests on a test directory or copy of your intended directory/subdirectories first to be safe
     
    • Like Like x 1
  10. Mrbo

    Mrbo Member

    97
    7
    8
    Jun 17, 2018
    Ratings:
    +7
    Local Time:
    5:37 AM
    It didnt work to set min depth to 0. I tried to remove max and min depth but that didnt work either. Is there any other solution or workaround?
     
  11. eva2000

    eva2000 Administrator Staff Member

    39,199
    8,654
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,307
    Local Time:
    8:37 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    just do /upload top level as a separate optimise-images.sh command run against the path to upload directory itself
     
  12. Mrbo

    Mrbo Member

    97
    7
    8
    Jun 17, 2018
    Ratings:
    +7
    Local Time:
    5:37 AM
    Hi! I tried multiple ways to get it working on root /upload but I think im not getting it since nothing happens?

    Would you mind explaining a bit more on what I should do to get it to run on root of the upload?
     
  13. eva2000

    eva2000 Administrator Staff Member

    39,199
    8,654
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,307
    Local Time:
    8:37 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    from centminmod/optimise-images just pointing to directory doesn't work ?

    to profile first
    Code (Text):
    /root/tools/optimise-images/optimise-images.sh profile /home/nginx/domains/webdigitos.com/public/wp-content/uploads
    

    what do you get for output

    post output in CODE/CODEB tags if it's very long just an excerpt of a few lines would do listing images it picked up in profile mode i.e. centminmod/optimise-images
     
  14. Mrbo

    Mrbo Member

    97
    7
    8
    Jun 17, 2018
    Ratings:
    +7
    Local Time:
    5:37 AM
    The output just goes on like this for a few 100 lines.

    Code:
    images in /home/nginx/domains/webdigitos.com/public/wp-content/uploads
    logged at /home/optimise-logs/profile-log-230319-183027.log
    ------------------------------------------------------------------------------
    image : 50827418_23843194711290157_7060222641671503872_n-24x24.png : 24 : 24 : 92 : False : 8 : 1095 : nginx : nginx
    image : 50836078_23843400483450734_5906574617576734720_n-150x150.png : 150 : 150 : 92 : True : 8 : 21923 : nginx : nginx
    image : 50836078_23843400483450734_5906574617576734720_n-200x300.png : 200 : 300 : 92 : True : 8 : 43107 : nginx : nginx
    
    Should I change some specific code outlined in the tutorial?
     
..