Media Compressor
Opt-in reduction of image and scanned (image-only) PDF uploads on Webform file elements, for Drupal 11.3+ and Webform 6.3
Users/Customers often scan paperwork on a multi-function device (MFD) with "Scan to PDF", or upload phone photos. Both routinely produce 3-30 MB files. This module shrinks those files at upload time, before Drupal stores them, so every downstream consumer (submission storage, emails, handlers, exports) gets the smaller file.
What it does
JPEG / PNG / WebP:
- Rotated upright (EXIF orientation)
- resized to fit 2000 × 2000 px (default)
- re-encoded in the **same format**
- All metadata (GPS, camera serials) is removed
- Compression options configurable
- There is an option to convert images to JPEG, but that is documented individually
PDF, where every page is exactly one full-page JPEG or 8-bit raster image, and nothing else:
Rebuilt as a new PDF with the same page count, order, size and rotation
- each page image down-sampled to 150 dpi (default)
- JPEG quality 70
- Compression options configurable
Anything else (Word, Excel, GIF, TIFF, born-digital PDFs, OCR'd/searchable PDFs, PDFs with forms, links, attachments, scripts, signatures, encryption, CMYK or black-and-white CCITT/JBIG2 scans, etc.)
- Left untouched
The file is only replaced if the result is at least 10% smaller (default).
The file name, extension and MIME type never change.
Typical results from testing (see the security review for the full test set):
Test file - Before - After
3-page colour A4 scan @ 300 dpi (JPEG) - 8.2 MB - 0.77 MB
1-page A4 scan @ 300 dpi (lossless / Flate) - 10.2 MB - 0.26 MB
12 MP phone photo - 5.8 MB - 0.34 MB
Depends on
Dependencies of the latest stable release
- Webform
- file Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.0.1 | Stable | 11 | Opt-in compression of images and scanned, image-only PDFs uploaded through Webform file fields. Shrinks each file at upload, before Drupal stores it, so every downstream consumer gets the smaller file. Off by default at every level. | Sep 19, 2026 | |
| 1.0.0 | Stable | 11 | Compresses images and scanned PDFs at upload time on Webform file fields. Opt-in, format-preserving, and safe by default. | Sep 19, 2026 |