Use attachment metadata for thumbnails.

Removes unnecessary file system checks, should improve performance and help with dphiffer/wp-json-api#18