Image optimizer icon

Image optimizer

Shrink your moodledata without touching your courses. Image optimizer is an admin tool that quietly walks Moodle's file storage on a schedule, finds images larger than a threshold you set, and resizes and recompresses them — capping dimensions, lowering quality to a sensible level, and optionally converting to JPEG or WEBP. Files keep their original names so images embedded in labels, pages and forum posts keep working, and every processed file is tracked so it is never touched twice. Built-in decompression-bomb protection refuses to decode absurdly large images. Uses Imagick when available, GD otherwise.
Price option: Free

Supports Moodle 5.0-5.2 See all versions
Latest release: 1 week ago
Installations: 2
Downloads (last 90 days): 21

Frankenstyle name: tool_imageoptimizer
Administration tools

Description

Students and teachers upload photos straight from their phones — 8 MB, 4000 pixels wide, destined to be displayed at 600. Multiply by a few thousand uploads and moodledata bloats, backups crawl, and page loads suffer. Image optimizer (tool_imageoptimize) fixes this at the source.

A scheduled task (every 15 minutes by default) scans Moodle's file storage for images above a configurable size threshold and processes them: resizing anything larger than your maximum width/height, re-encoding at your chosen quality, and optionally converting to JPEG or WEBP. It prefers Imagick and falls back to GD, and it re-checks actual byte savings — a file is only replaced when the optimized version is genuinely smaller.

The details are handled carefully. Optimized files keep their original filename, because rich-text content embeds images by filename via @@PLUGINFILE@@ and renaming would break them; the mimetype is set from the re-encoded content. A tracking table remembers processed files so nothing is optimized twice. Before any decode, declared dimensions are checked so a tiny crafted file can't trigger memory exhaustion (decompression bomb).

Everything is configurable under Site administration > Server, the privacy API is fully implemented, and PHPUnit tests plus CI cover Moodle 5.0–5.2. 

Contributors

Awards

Privacy friendly
Automated testing support