-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF thumbnails to WEBP/AVIF #1766
Comments
Hey @1ucay If I understand correctly, the issue is that PDF uploads should generate previews, but generation is blocked because I did try to replicate the issue and did not get pdf previews but I was unable to confirm if that is due to If you could revisit the issue once more and provide replication instructions, it would be very helpful. |
Dear @AhmarZaidi |
you can add application/pdf over webp_uploads_upload_image_mime_transforms |
@1ucay Thanks for the confirmation. There already exist a filter
A possible solution could be to add Now, it doesn't work when I have the dev environment running using
This appears to be an issue with ![]() However, looking into the core file reveal that it should work so I tested the solution on other setups like localWP (by separately adding Screen.Recording.2025-02-12.at.8.48.56.AM.movFeel free to let me know if I've understood or implemented something incorrectly. |
I have some workaround for this. but it so hacky ;) I can upload even PSD file (image/vnd.adobe.photoshop), which is by ImageMagick supported format. It will create thumbnail sizes (jpg,avif), I can even work in WP image editor (cropping etc). But it will be separate plugin. Best solution for every usecase would be add filter to wp_attachment_is_image. So user can override function. You have to change post_mime_type in WP Post object after filter "webp_uploads_pre_generate_additional_image_source"
|
I've created a draft PR with the previous approach before noticing there's an update 😅:
Will be reviewing and testing the new approach:
|
Nice, thank you, but it is solution only for PDF :) My proposal
|
Dear all,
if you upload PDF, in metadata sizes we have array with jpgs.
I tried fix with
If you upload PSD with mime image/vnd.adobe.photoshop and genereate sizes with some custom code (imagemagick support PSD) like PDF does
it working ok. I have nice jpg and avif in metadata.
But, different situation is with PDF mime application/pdf. It is blocked by helper.php line 145
and inside function is condition
We dont have any filter skip this check, so PDF avif is not working. Best would be add filter to "wp_attachment_is" and override.
Im working on LibreOffice (exec soffice), audiowave (exec https://github.com/bbc/audiowaveform ) , PSD / AI (imagemagick) thumbnailer.
https://core.trac.wordpress.org/ticket/62712
The text was updated successfully, but these errors were encountered: