Open makbeta opened 4 years ago
The code indicated by @makbeta above seems to work for Regenerate Thumbnails version 3.1.5 as of 2022-06-01 (using WordPress version 6.0).
However, to regenerate a thumbnail for a PDF in the Media Library, you can only do that if you use the Bulk Actions in the Media Library and have selected a PDF using the checkbox. (That is, the option to regenerate a PDF thumbnail does NOT appear when editing the Media, nor does it appear below the title of the Media in the Media Library list view.)
Also, IMHO the thumbnail generated is very bitmappy, and yes, ImageMagick library is in PHP.
However, to regenerate a thumbnail for a PDF in the Media Library, you can only do that if you use the Bulk Actions in the Media Library and have selected a PDF using the checkbox. (That is, the option to regenerate a PDF thumbnail does NOT appear when editing the Media, nor does it appear below the title of the Media in the Media Library list view.)
This is true. However, if you do a bulk operation of attachments of various types, the error message is confusing ant unnecessary.
Skipped Attachment ID nnnn (filename): The fullsize image file cannot be found in your uploads directory at . Without it, new thumbnail images can't be generated.
Also, IMHO the thumbnail generated is very bitmappy, and yes, ImageMagick library is in PHP.
I know users who rely on the PDF bitmaps, and they are created in multiple resolutions from full-size, 1024 height and downwards, so I've not been seeing the poor image quality other people have reported.
I've submitted a merge request for commit 27c7083a2253fb5e6ed14c001346c745a33c78d8.
The PDF files were skipped and thumbnails weren't generating. Tracked down the issue to a function
get_fullsizepath()
on lines 130-135 in file class-regeneratethumbnails-regenerator.php. The functionwp_get_original_image_path()
will returnfalse
for PDF file.The fix is to check for the false positive and fetch PDFs properly.
Code before:
Code with a fix: