oooh this is a good question.
First, start from a backup. If you don’t have a sql backup, install this, and don’t sleep until you’re sure it’s working
https://wordpress.org/plugins/backupwordpress/
Second, maybe try this plugin? It works really great otherwise, but I’m not sure if it scans the directories or posts table for attachments.
http://wordpress.org/plugins/regenerate-thumbnails/
I’ll do some more research, see if I can find ya anything.
Cheers!
Regenerate Thumbnails does in fact do a db query to find the images.
This post seems similar and says the following plugin will work:
http://wordpress.org/support/topic/media-library-rebuild-after-site-move?replies=11
http://wordpress.org/plugins/add-from-server/
It doesn’t seem to *recreate* a Media Library from an uploads folder though, which I think is what you want. It might be a good stop gap though.
I would be interested in making a quick plugin. Don’t want to over promise anything, and I wouldn’t be able to take a stab at it until tonight at the earliest. But might be a quick interesting project.
Is the wp_posts/wp_postmeta table completely gone? Just corrupted? I feel anything would be better than nothing at this point.
I wrote something a few weeks back. It rebuilds image meta data:
https://github.com/WPRanger/wpr-rebuild-meta-data
Thanks Casey. WPRanger, I’ll give your plugin a try – it looks promising.