1

I have a media library containing 500 images. I need to make some modifications to these images in Photoshop (batch resizing and color correction). I'm looking for a way to simply overwrite the files in the 'wp-content/uploads' directory without having to re-upload them via the media library. The file names will stay the same. I also want to be able to retain the title, alt, caption and description associated with the old image files.

What would be the most efficient way of going about this?

2 Answers 2

3

Well, I think the easiest way would be the following:

  • Download your wp-content/uploads/ folder so you have all images on your hard disk
  • Remove the images WordPress has automatically generated (the ones with -*x*.jpg, maybe read this if you have SSH access as a filename)
  • Optimize your base images with Photoshop
  • Reupload the images into the wp-content/uploads/ folder
  • Use a plugin like "Regenerate Thumbnails" (I use that one often) to rebuild all the necessary images

This should work, but I have not tested it.

Important! Do not change the filenames of your base-images, otherwise WordPress will not find them after reuploading. (Yeah, seems obvious, mentioned it just for clarification...)

5
  • Thanks! I'm going to give this a try. Do you happen to know if WP stores the image dimensions from media library items in the database? Commented Oct 28, 2015 at 12:37
  • Actually it is saving that in the wp_postmeta table, yes. It´s serialized and saved as _wp_attachment_metadata.
    – flomei
    Commented Oct 28, 2015 at 20:59
  • 1
    This sorta worked! I could not get the SSH script to delete the files for some reason, so I used this plugin: wordpress.org/plugins/force-regenerate-thumbnails Commented Nov 1, 2015 at 18:55
  • 1
    I´m glad it worked for you.
    – flomei
    Commented Nov 1, 2015 at 20:41
  • 1
    It really is the time saver. just imagine I had 150 product images with all the generated ones by wordpress. in less than 10 minutes, work done :) Commented Dec 18, 2020 at 11:43
-1

Try to download the uploads folder all together or you will lose the quality of the images, then re-upload them with the same name and description to the same folder

4
  • 1
    While I tend to agree with you, can you please elaborate on the answer a bit.
    – s_ha_dum
    Commented Oct 27, 2015 at 20:03
  • I'm not sure this method will work since I'm be resizing the images, right? Commented Oct 27, 2015 at 20:05
  • @s_ha_dum you have to download it from the uploads folder or download the uploads folder all together then modifying it, because of this way you wont lose your image quality
    – bbadawee
    Commented Oct 27, 2015 at 23:26
  • 2
    @bzhar93 : edit your answer instead of posting clarifications in the comments.
    – s_ha_dum
    Commented Oct 27, 2015 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.