Check if attachment is an image before showing the thumbnail

When you now retrieve the title of an attachment it always trying to show a thumbnail. This only works for images and not for the rest. It now uses wp_get_attachment_image() to check if it's an image.