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
OnPoint Plugins
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
NEW
Some additional questions to help narrow this down:
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.
Philip
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
OnPoint Plugins
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.
Philip
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
OnPoint Plugins
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:
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
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.
Philip
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