Fix issue preventing regeneration of PDF attachment thumbnails, refs #94 #126
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I try to regenerate the thumbnails of a PDF attachment I receive the following error message:
The error message is misleading as there is no issue with the fullsize attachment file.
regenerate-thumbnails/includes/class-regeneratethumbnails-regenerator.php
Line 131 in 5a8b431
The function call above evaluates to
false
ifwp_attachment_is_image($attachment_id)
evaluates tofalse
(see why in the WordPress reference). So in particular when dealing with PDF attachmentswp_get_original_image_path($attachment_id, ...)
always evaluates tofalse
and in turn triggers theregenerate_thumbnails_regenerator_file_not_found
error with the message above.I would suggest to use
get_attached_file( $this->attachment->ID )
as thefullsizepath
when we are not dealing with an image attachment. This way PDF attachment thumbnails get regenerated as intended.This issue has already been raised in #94.