Regenerate Thumbnails using command-line

I am using the Thumb regenerator plugin, while the process of regenerating thumbnails it stopped at 55% and I got this message:
“If you have command-line access to your site’s server, consider using WP-CLI instead of this tool. It has a built-in regenerate command that works similarly to this tool but should be significantly faster since it has the advantage of being a command-line tool.”

Is it possible to apply this on my Staging site using WP-CLI?

  • Adam Czajczyk
    • Support Gorilla

    Hello SABER

    I hope you’re well today and thank you for your question!

    Yes, it is possible to be applied on a staging site using WP-CLI. Here’s what you’d need to do:

    1) create an SSH account for your staging site if you don’t have one yet (you can do it in “SFTP/SSH” tab of your Hosting panel in The Hub – just make sure to select “staging” when crating SSH account)

    2) access the site via SSH

    3) go to the /site/public_html folder

    cd /site/public_html

    4) optional but highly recommended: create a backup of the site by issuing following commands

    wp db export backup.db

    zip -r backup.zip .

    5) once that’s done issue this command to regenerate all thumbnails

    wp media regenerate --yes

    [reference: https://developer.wordpress.org/cli/commands/media/regenerate/]

    This would regenerate all the thumbnails of all registered sizes, on the staging site, without asking for confirmation.

    If you have any additional questions or need further assistance with it, let me know, please.

    Kind regards,
    Adam

  • SABER
    • Flash Drive

    Hi Adam,

    Thank you for your response. it sounds good that its doable. However, I am really clueless about how to do this. Would you be kind to start this for me and get this done on our staging so we can Smush the thumbs to 30px afterward.

    Thank you so much
    Saber

  • Predrag Dubajic
    • Support

    Hi Saber,

    I have created backups for you but due to the number of images on installation this process will last for few of hours so it’s not something that we could do for you.

    Since the backups are created all that is left now is to run the regenerate process and leave it to finish.

    To do this first you need SSH account, access your site panel on our hosting and go to SFTP/SSH tab.
    In there create a new SSH account for staging site (this is selected during SSH creation).
    Open Comand Prompt (if you are on Windows) or Terminal (on Mac) and connect to SSH by using this line:
    ssh username@yoursiteid.wpmudev.host
    Of course, replace username and yoursiteid first.
    It will ask you if you wish to connect so type in yes and hit enter.

    After that you need to enter your password, note that it won’t show that you’re typing but that’s normal, so just type in the password and hit enter.

    After that it will start the connection so all you need to do is run the command for thumbnail regenerate:
    wp media regenerate --yes

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.