This module automatically reduces the size of uploaded image and image-only PDF files within Webform submissions. It optimizes images by resizing, re-encoding, and removing metadata, and rebuilds PDFs using compressed images, while leaving other file types unchanged. Files are only replaced if the compression results in a significant size reduction.
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
Ask your assistant about Media Compressor
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
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.