Removed significant code duplication. Finished detecting and retrieving media thumbnails. Should now correctly handle AV, Ghostscript, Imagick, Google Drive Viewer, and default fallback thumbnail generators. Additionally, filter was added to allow other developers to provide thumbnail generation.

git-svn-id: https://plugins.svn.wordpress.org/document-gallery/trunk@834214 b8457f37-d9ea-0310-8a92-e5e31aec5664