Thread Starter
RVOLA
(@rvola)
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 5 years, 8 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.
Thread Starter
RVOLA
(@rvola)
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.
Thread Starter
RVOLA
(@rvola)
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,
Thread Starter
RVOLA
(@rvola)
Well done !
I had not retested this function since the addition of verification of WP 4.7.
I just made your changes and push