From http://wp-snippets.com/check-if-a-post-has-more-than-one-image-attached/