manifest / unclassified / wpfh-image-memory-guard
WPFH Image Memory Guard
High-Res Image Memory Guard & Resizer for WordPress (Prevents PHP Memory Crashes)
★ 0stars
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/wpforgehub/wpfh-image-memory-guard/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
WPFH Image Memory Guard eliminates PHP fatal memory exhaustion errors during WordPress media uploads and thumbnail generation.
⚡ The Problem
When WordPress uploads and resizes images, GD and ImageMagick decompress every pixel into raw uncompressed RAM. A typical 24-megapixel smartphone photo requires over 180MB of RAM to decompress and slice into intermediate thumbnails.
On servers with typical 128MB or 256MB PHP memory limits, this causes:
Fatal error: Allowed memory size exhausted- Media library upload stalls with cryptic "HTTP error"
- Orphaned attachment entries in the database
🛡️ The Solution
- Pre-Flight Memory Calculation: Inspects file headers via
getimagesize()without memory allocation. - Safe Auto-Downscaling: Scales master files down to safe dimensions before GD/Imagick triggers thumbnail generation.
- Dynamic Memory Elevation: Temporarily elevates memory limit during thumbnail generation.
- Garbage Collection Hook: Cleans up memory buffers after processing.
- Interactive Budget Calculator: Test any resolution against your host limits inside WP Admin.
🚀 Pro Features
- Background Chunked Resizing: Queue heavy resizing in background workers.
- WebP & AVIF Auto-Conversion: Generate next-gen images with CPU throttling.
- WP-CLI Library Audit: Inspect and optimize your existing media library from the terminal.
- EXIF Privacy Sanitizer: Strip GPS and device identifiers.
📄 License
GPL-2.0+ © WPForgeHub.