I organized my snapshot galleries today. While doing so I accidentally deleted a gallery full of photos. I was thinking one thing but doing another. Fortunately, the Image.module for Drupal doesn't actually delete the files. It just unlinks the category associations to them. The image nodes remain intact, but they can be hard to locate. To find any and all orphaned image nodes, do this:
SELECT n.nid
FROM node n
WHERE NOT EXISTS (SELECT * FROM term_node tn
WHERE tn.nid = n.nid)
AND n.type LIKE 'image';You could also create a new gallery and assign all these orphans to it right away, but you'll have to figure that query out on your own.
