I provided a patch to fix the issue.
I have made the patch compatible with https://www.drupal.org/project/better_field_descriptions/issues/3296624#... 📌 Automated Drupal 10 compatibility fixes Needs review
Steps to reproduce
Generate a PDF Image of a PDF with 160 or more pages.
Proposed resolution
The Media PDF Thumbnail Module utilizes the URI instead of the realpath. For instance, it employs the format public://foo/bar.pdf.
When the path is remote, the spartie/pdf-to-image library generates images for every page of the PDF. It verifies whether the path is remote by using the filter_var($path, FILTER_VALIDATE_URL)
function. However, when a Drupal URI is provided, the spartie/pdf-to-image library mistakenly considers the file as remote and proceeds to generate images for all pages.
Consequently, when dealing with PDF files that contain numerous pages, imagick consumes a significant amount of temporary space on the server.
I provided a patch to fix the issue.