OnPoint Plugins

  • Plugins
    • Advanced Sidebar Menu
      • Basic Version
        • Documenation
        • Usage
        • Developer Docs
      • PRO Version
        • Demo
        • Usage
        • Developer Docs
    • Go Live Update Urls
      • Basic Version
        • Documenation
        • Usage
        • Troubleshooting
      • PRO Version
        • Demo
        • Usage
        • URL History
  • About
    • Services
    • Showcase
  • Blog
  • Contact
  • Support
  • Log In
← Back to support

Looking for input – replacing media URLs

Resolved

Requested: 1 year and 2 months ago

I have a site that currently about 500 images in the media library. These are stock images which we are moving over to Google Drive.

The issue is that for example 1 image has 2 “thumbnail sizes” so I really need to do 3 find and replaces.

 

The bigger issue is then I have this same library replicated on multiple websites.

 

So my question is…. is there a way to upload a csv with the original and new urls and have it do it in batch as I can do a find and replace in the CSV for each original domain as the paths will all be the same

 

Thanks for you help with the brainstorming on this

Plugin: Go Live Update Urls

  1. Avatar for OnPoint PluginsOnPoint Plugins

    1 year and 2 months ago

    Hi Philip,

    It would help us consider options to see an example an image URL before and after with all images sizes included. Something like:

    OLD

    1. https://example.com/wp-content/uploads/2023/12/01/test-image
    2. https://example.com/wp-content/uploads/2023/12/01/test-image-300X400
    3. https://example.com/wp-content/uploads/2023/12/01/test-image-900×600

    NEW

    1. https://google-something.com/some-hash/2023/12/01/test-image
    2. https://google-something.com/some-hash/2023/12/01/test-image-300X400
    3. https://google-something.com/some-hash/2023/12/01/test-image-900×600

    Some additional questions to help narrow this down:

    1. Are you able to use WP-CLI as an option?
    2. Does every image have the same thumbnail sizes?

    Whatever we come up with will have to be thought of as running small batches as I’m pretty sure that running Go Live update process 1,500 times at once will crash.

  2. Avatar for PhilipPhilip

    1 year and 2 months ago

    No problem –

    I was thinking a 2 column CSV upload Column 1 being Old/Current and Column 2 being new

    I would think from a programing standpoint

    it would be a for each loop running the updates and then pause say 30 seconds and proceed to the next

    I would probably only do one folder at a time – the largest folder has 90 images.

     
    I told the client that this may not be worth the effort – while saving on disk space and INODES – for 40k INODES on one server which is about the size of 1 website – there will be ALOT of work to generate the CSV to start with

    https://drive.google.com/thumbnail?sz=w1920&id=1eNRzDu8WdZeEPSNEgZOIfXkL1RiEbpQ7
    Replaces
    https://00-clone.myspoondrawer.com/wp-content/uploads/2024/01/e81b9b7f-bgimage2
    https://00-clone.myspoondrawer.com/wp-content/uploads/2024/01/e81b9b7f-bgimage2-205×300
    https://00-clone.myspoondrawer.com/wp-content/uploads/2024/01/e81b9b7f-bgimage2-150×150

  3. Avatar for OnPoint PluginsOnPoint Plugins

    1 year and 2 months ago

    I agree the tricky part will be generating the CSV because the Google URL does not have any common parts with the image URL.

    If you can create the CSV, I can write a WP-CLI command which will loop through it and run the Go Live update process for each line in the CSV. Pausing between batches to free up memory and let the MySQL server calm down.

    Or if you just want some inspiration, here is a WP-CLI command which supports passing multiple URL on the command line.

  4. Avatar for PhilipPhilip

    1 year and 2 months ago

    So the WP CLI route would probably be best.

    I can generate the CSV.

    The only thing I’m not following is you gave the CLI php in your last reply – are you saying this is the code to modify to accept CSV or is it already there and I would just need to do
    wp go-live urlupdates.csv

    ??
    Thanks

  5. Avatar for OnPoint PluginsOnPoint Plugins

    1 year and 2 months ago

    The provided CLI code is just an example of how to run multiple URL at once in case you wanted to write the full command yourself. It does not yet support a CSV file nor running in batches.

    The example code:

    1. Adds a new wp go-live multiple-url command which accepts a string CSV value like so --old=http://example.com,http://test.com and --new=https://first-new.com,http://second-new.com
    2. Could be added to a plugin or theme.
    3. Registered like so WP_CLI::add_command( Go_Live::COMMAND, Multiple_Url::class );

    It would still need to be modified to accept a CSV file and run in batches, but it provides a good starting point.

  6. Avatar for PhilipPhilip

    1 year and 2 months ago

    Great – I appreciate it, this was much more brainstorming than I expected – again I really appreciate the help

     

    have a wondering day and I’m mark this as closed

     

New Response Cancel reply

You must be logged in to respond. Only PRO members are allowed to respond to support requests.

© 2025 · WordPress Development · Terms Of Service · Privacy Policy · Cookie Policy · Log in

  • Plugins
  • Blog
  • Contact