Sort and delete unused images (speed optimisation), need advice

  • This topic has 3 replies, 1 voice, and was last updated 1 week, 2 days ago by GlitchyDragon65.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5733
    gh0st_Fr
    Participant

    With my colleague, we are in a site speed optimization period, deleting unused plugins, calling scripts only where they’re need etc…

    Now, it’s time to gain space with images. Our WordPress has hundreds of pics but, we need juste 30-40% of them. I know that plugin exist but :

    * little bit scared to let plugin delete things in the database
    * personal challenge !
    * trying to understand a little bit more how WordPress works

    ​

    So I search how to do that myself and set up few steps.

    1. Sort used and unused images
    2. Where and how delete unused pics in the database
    3. create a new uploads folder with only the pics we need

    ​

    I have created a script that performs all these steps (you can look and try it on my Github > [https://github.com/yannis94/sort_images](https://github.com/yannis94/sort_images) )

    Everything works, the script creates a new uploads folder and a SQL script, but I’m still doubtful.

    The next step is to execute the SQL script on the server and replace the uploads folder, I’ve tried it locally and it works, but stay a little bit scared to do that on my company’s web site ^^.

    I still hesitate to fell very smart and proud of it or the total opposite, can you guys tell me what do you think about that process and if you think that it will works ?

    ​

    If you are interesting to update my script or giving some tips, I will be glade of this

    #5734
    xhr2
    Guest

    Seems like you’re on the right track but why are you copying the used images to a new folder? Your SQL scripts don’t update their paths in the database so it seems this step is redundant.

    #5735
    legen_dar33
    Guest

    Always happy to see new development, but if you decide to go with a plugin in the end, this one has worked well for me. It puts deleted files into a temp folder, so that if stuff is missing from your site, you can restore the files before deleting them completely.

    Media Cleaner – Clean & Optimize Space

    #5736
    GlitchyDragon65
    Guest

    If your using wordpress use should use Smush or else you can see the source code by downloading you can search at wordpress.org

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.