How to organize a Media Library and restore uploaded images in WordPress?
-
I recently made some changes to my WordPress site. Previously, I switched between a few themes that had plugins cropping uploaded images into multiple sizes.
I recently created my own WordPress theme and plugins. In the process, I cleaned up my media library by deleting all images, as previous themes and plugins had generated a lot of unnecessary image sizes.
Here’s what my media library structure looked like before:
2021 > 01 > image-one.jpg
image-one-150×150.jpg
image-one-300×300.jpg
image-one-500×500.jpg2021 > 02 > image-two.jpg
image-two-150×150.jpg
image-two-300×300.jpg
image-two-500×500.jpg2021 > 03 > image-three.jpg
image-three-150×150.jpg
image-three-300×300.jpg
image-three-500×500.jpgI deleted all images from the media library, so currently, I have no images in the gallery. My custom theme only keeps the original image size (850x600px) and generates a smaller version (500x353px).
Using image resizing software, I re-created all the images with the same file names but resized dimensions and uploaded them back into their original wp-content/uploads folders (organized by year and month) using FTP.
2021 > 01 > image-one.jpg
image-one-500×353.jpg2021 > 02 > image-two.jpg
image-two-500×353.jpg2021 > 03 > image-three.jpg
image-three-500×353.jpgI then uploaded these images back to the original year and month folders using FTP (e.g., wp-content/uploads/2021/01, 2021/02, etc.).
Question:
Is there any way to make these images show up in the WordPress media library again, while keeping them organized in their respective year and month folders?
My goal is to re-register all the images in the media library and automatically set the re-uploaded images as featured images for the posts they were originally assigned to.
Is there an easy way to achieve this?
- You must be logged in to reply to this topic.