Make WordPress Core

Opened 4 hours ago

Last modified 22 minutes ago

#64593 new defect (bug)

allow PDF preview generation without sizes

Reported by: aryanrajseo's profile aryanrajseo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.9.1
Component: Media Keywords: 2nd-opinion needs-patch
Focuses: administration Cc:

Description

Currently when we upload a pdf, it generates PDF preview with different thumbnail and sizes. However when we disable the additional media sizes to 0 in settings > Media. The PDF previews no longer get generated.

The idea is to remove dependency on media sizes to generate the pdf preview. In Library we already get full size for a pdf. file-name.pdf have file-name-pdf.jpg

Steps:

  1. Upload a pdf in Media Library /wp-admin/upload.php

Result - Pdf preview get generated with all enabled sizes.

  1. Disable cropping/additional thumbnail sizes in Settings > Media by setting the value 0x0.

Result - PDF preview shows an icon /wp-includes/images/media/document.svg

Expectation:
Uploading pdf generate the default full size preview which we see in Library without even if other media sizes are disabled.

Attachments (2)

SCR-20260204-jntc.png (247.4 KB) - added by aryanrajseo 4 hours ago.
SCR-20260204-jnun.png (178.0 KB) - added by aryanrajseo 4 hours ago.

Download all attachments as: .zip

Change History (4)

#1 @aryanrajseo
4 hours ago

  • Component changed from Post Thumbnails to Media

#2 @Presskopp
22 minutes ago

I agree that the missing PDF previews are a real issue and should be addressed. However, this ticket also highlights a more general question about how WordPress decides whether media previews and other derived files should be created.

At the moment, setting image sizes to 0 is commonly used to effectively turn off thumbnail generation. This behavior is widely relied upon, but it is not clearly defined and ends up influencing things that users would not necessarily expect, such as PDF previews.

From a user and product perspective, image dimensions describe the size of images, not whether previews or other media representations should exist at all. Still, changing the behavior of 0 is not an option, as many sites depend on it today.

Instead of fixing PDF previews in isolation, it may be worth discussing a more general and explicit way to decide when derived media files should be created, while keeping the current behavior for existing sites fully intact.

Note: See TracTickets for help on using tickets.