There are a lot of academic papers on detecting things like skin-tones, common shapes etc in photos.
Sorry I don't have any links off-hand but search for nude image detector or porn detector etc and you should run into some PDFs.
I remember reading one by google guys about how they implemented the safe search filter for image search. It all comes down to identifying some features of the photo and running in through a trained ANN or SVM.