Support » Plugin: Force Regenerate Thumbnails » Regenerate PDF with WordPress 4.7

  • The new version of WordPress 4.7 (December approach) allows if the server has the ImageMagick library and Ghostscript to be able to create an image of the first page of a PDF file.

    https://make.wordpress.org/core/2016/11/15/enhanced-pdf-support-4-7/

    In testing the beta version, I realized that the plugin does not take into processed the PDF.

    If you want to use the Force Regenerate Thumbnails plugin to process old PDFs on your website, you need to comment out the following lines in the plug-in:

    force-regenerate-thumbnails.php#130
    force-regenerate-thumbnails.php#131
    force-regenerate-thumbnails.php#455
    force-regenerate-thumbnails.php#456
    force-regenerate-thumbnails.php#457

    You can also use the fork on GitHub here: https://github.com/rvola/force-regenerate-thumbnails

    At this point you will be able to regenerate PDF previews.
    I hope the author will improve this in the new version.

Viewing 8 replies - 1 through 8 (of 8 total)
  • I have just made a number of changes in the fork version.
    Instead of removing checks, here are the updates:

    • Adding permissions processed PDF files
    • Changes in error messages that take into account the file type or whether the imagick extension is loaded
    • Add PDF files to the loop to regenerate all media
    • Check if the ‘imagick’ extension is loaded
    • Check if WordPress is at least equal to 4.7

    https://github.com/rvola/force-regenerate-thumbnails

    • This reply was modified 3 years, 11 months ago by RVOLA.

    Hi

    I tried regenerating thumbnail previews for PDF files uploaded before WordPress 4.7. I used the fork from GitHub.

    I was unable to generate thumbnails for PDF files.

    Can’t figure out why.

    It also does not show a regenrate thumbnail link below PDF file on the Media screen.

    Hi Noumaan,

    Then to redo a single image, put the “list” mode on the media page.
    If next to a PDF file you do not see “Force Regenerate Thumbnails” and you have WordPress 4.7, the imagemagick library is not installed on your server.

    This library is required for WordPress 4.7 to work on PDFs.
    I invite you to read here: https://make.wordpress.org/core/2016/11/15/enhanced-pdf-support-4-7/

    You can do the test also by sending a PDF file, if you do not see a thumbnail imagemagick is not installed.

    Hi RVOLA,

    I have imagemagick and 4.7 both installed. I can create thumbnail previews for new uploads. Still I can’t see the link to regenerate thumbnail for PDF file. I can see it for image files.

    Hi RVOLA,

    I am able to see the force regenrate thumbnail option under the PDF files on Media page now.

    however, when running the tool to regenerate all thumbnails, it does not detect PDF files. I have 8 other images in Media library, the plugin detects them and regenerates thumbnails for them. It does not detect the two other PDF documents.

    I deleted all other images and left just one PDF document in the library. I then went to tools > Force regenerate Thumbnails page. When tried to generate thumbnails I got this error message:

    Unable to find any images. Are you sure some exist?

    I should have seen this error message:

    Unable to find any images or files pdf. Are you sure some exist?

    I thought there is something wrong with the way plugin is trying to detect imagemagick. I studied the code and found this line 250:

    if (extension_loaded('imagick') && version_compare( $wp_version, '4.7', '>')) {

    I think that since I am using 4.7 which is not greater than 4.7 the plugin fails to queue PDF files. So I replaced it with this:

    if (extension_loaded('imagick') && version_compare( $wp_version, '4.7', '>=')) {

    and this worked. Can you please double check it and update the plugin?

    Thanks for sharing,

    Well done !
    I had not retested this function since the addition of verification of WP 4.7.
    I just made your changes and push

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Regenerate PDF with WordPress 4.7’ is closed to new replies.