• I have 20,000 products on my site. I have higher quality images I would like to upload to the site.

    I need to replace the images with the new versions. I know there are plugins to place media, but there are tens-of-thousands of images. These plugins allow for individual replacement only.

    So say I have this image SKU-A-1.jpg on the media library

    I would like to SEAMLESSLY replace SKU-A-1.jpg with a file of the SAME NAME. Without having to re-name the file. If you have any information on this topic, please advise. I could greatly use any ideas.

Viewing 4 replies - 1 through 4 (of 4 total)
  • This sounds to me more like a custom solution that you could write yourself via PHP. If you want to do it yourself, the developer manual would be the first place to go: https://developer.www.ads-software.com/plugins/ – I would recommend to run the process via WP CLI due to the amount of data, there is no timeout.

    Alternatively you can look for someone here who can support you: https://jobs.wordpress.net

    Thread Starter classicimportusa

    (@classicimportusa)

    I am going to try using ssh with the find . -name command and a csv file to delete all the old images and their thumbnails from the uploads folder on a staging site.

    Then I should be able to upload the new photos directly to the media library and reupload the product csv sheet to utilize the new images after cache-clearing. I will close this topic if it works. Let me know if there are any solutions that come to mind tho.

    Deleting the files from disk will not remove their records. You’ll be left with a bunch of records that don’t point to any existing file. You can’t then upload the updated images via media upload to replace them – that would create new filenames, not replace the old ones.

    But the idea via SSH is sympathetic. You could replace all images via SSH and then regenerate the thumbnails via Regenerate Thumbnails. The only problem is that if the database contains information about the images (as some plugins do), it will no longer match the actual technical properties.

    A clean way would be as said a PHP script which exchanges the images via WordPress functions.

    Please remember to make a backup of your project before each change.

    Thread Starter classicimportusa

    (@classicimportusa)

    I have foreseen the issue you mention. My intention is to remove the files via ssh, then clean them from the media library using the Media Cleaner plugin by MeowApps. I am testing it right now to see if it recognizes the empty images.

    Since, when I delete a file it leaves the media entry (which is blank) I cannot upload a new image with the same filename. If I delete the file, then compare the media library with the filesystem using the Media Cleaner, I should be able to delete the broken media library entries and reupload my products and new images.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Replacing Media’ is closed to new replies.