When PDF preview images are available, how does the Media Library determine that it needs to display them? Does it check for a '_wp_attachment_metadata' record in the postmeta table? And where in Wordpress is the code that does this?
The preview images for PDF documents are created within
The full size preview image will have the
-pdf.jpg extension [src].
The preview images info for the PDF document is stored in
_wp_attachment_metadata in the post meta table.
Here's an example data for a
Array (  => Array ( [sizes] => Array ( [thumbnail] => Array ( [file] => test-pdf-116x150.jpg [width] => 116 [height] => 150 [mime-type] => image/jpeg ) [full] => Array ( [file] => test-pdf.jpg [width] => 1088 [height] => 1408 [mime-type] => image/jpeg ) ) ) )
This is stored as a serialized array under the
_wp_attachment_metadata key in the post meta table, but we display it here as an array for better readability.
It's fetched with
wp_get_attachment_metadata() [src], as for any other image attachment.
We can see it e.g. in
The latter one is used by
wp_get_attachment_image(), that's called within the
column_title() method of the media list table, to display the image preview [src].
Hope it helps!