Media Optimizer
Automatic image optimization for WordPress
Media Optimizer automatically resizes, compresses, and converts images to WebP when you upload them. No external API needed—all processing happens on your server using ImageMagick or GD.
Getting Started
What you need:
- WordPress 5.8 or newer
- PHP 7.4 or newer
- GD or ImageMagick PHP extension (most hosts have these)
- Admin access to your site
To install:
- Download the plugin from your CraftedPath account
- In WordPress, go to Plugins → Add New → Upload Plugin
- Upload the zip file and click Activate
- Go to CraftedPath → Media Optimizer to configure
The plugin works immediately with sensible defaults. New uploads are automatically optimized.
How It Works
When you upload an image, the plugin:
- Resizes it if larger than max dimensions (default: 2560px)
- Converts it to WebP format
- Strips EXIF metadata (location data, camera info)
- Processes thumbnails the same way
The original file is replaced with the optimized version. WebP conversion keeps a fallback copy for older browsers.
Resize Settings
Automatically shrink oversized images to reasonable dimensions.
Max Width / Max Height Images larger than these dimensions are resized proportionally. The aspect ratio is preserved.
Default: 2560 x 2560 pixels (larger than most screens need)
When to adjust:
- Photography sites might want 3840px (4K)
- Blog sites might be fine with 1920px
- Lower = smaller files, faster loading
What gets resized: Only the original upload. WordPress still generates its standard thumbnail sizes (medium, large, etc.) from your resized image.
Compression Settings
Reduce file size while maintaining visual quality.
Quality (1-100) How much compression to apply. Lower = smaller files, more compression artifacts.
- Default: 82 (good balance)
- 90+ for photography where quality matters most
- 70-80 for blog images where speed matters more
What gets compressed:
- JPEG images use the quality setting directly
- PNG images use maximum lossless compression
- Thumbnails are compressed with the same settings
WebP Conversion
WebP is a modern image format that's typically 25-35% smaller than JPEG at the same quality.
Enable WebP When on, images are converted to WebP format on upload. The original JPEG/PNG is kept as a fallback.
Serve WebP
When on, the plugin outputs <picture> tags on your frontend that serve WebP to browsers that support it, with JPEG/PNG fallback for older browsers.
<picture>
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="...">
</picture>
WebP Quality (1-100) Separate quality setting for WebP conversion. Default: 80.
WebP handles compression differently than JPEG, so you might want different quality levels for each.
Strip EXIF Data
JPEG images often contain metadata:
- Camera make/model
- GPS coordinates (where the photo was taken)
- Date/time
- Camera settings
When enabled: All EXIF data is removed from JPEGs on upload. This:
- Reduces file size slightly
- Protects privacy (removes location data)
- Removes potentially sensitive information
When to disable: If you're a photographer who wants to preserve camera data in images.
Server Requirements
The plugin checks your server capabilities and uses the best available library.
ImageMagick (preferred)
- Better quality conversions
- Faster processing for large images
- Better WebP support
GD (fallback)
- Available on virtually all hosts
- Adequate for most use cases
- Some limitations with transparency
Check your setup: Go to CraftedPath → Media Optimizer. The settings page shows which libraries are available and whether WebP conversion is supported.
Default Settings
| Setting | Default | Description |
|---|---|---|
| Enable Resize | ON | Shrink oversized images |
| Max Width | 2560px | Maximum image width |
| Max Height | 2560px | Maximum image height |
| Enable Compression | ON | Compress images |
| Quality | 82 | JPEG compression quality |
| Enable WebP | ON | Convert to WebP format |
| WebP Quality | 80 | WebP compression quality |
| Serve WebP | ON | Use picture tags on frontend |
| Strip EXIF | ON | Remove metadata from JPEGs |
These defaults provide a good balance of quality and file size for most sites.
What About Existing Images?
Media Optimizer only processes new uploads. Existing images in your media library are not affected.
To optimize existing images: You'd need to re-upload them, or use a bulk optimization tool. This plugin focuses on optimizing at upload time to keep things simple and reliable.
Troubleshooting
"WebP conversion isn't working"
- Check that your server has WebP support (shown in plugin settings)
- Some shared hosts disable ImageMagick WebP
- GD WebP requires PHP 5.5+ with WebP support compiled in
"Images look blurry after upload"
- Your quality setting might be too low—try 85-90
- Check that resize dimensions aren't too small for your use case
- Some themes apply additional compression
"File sizes aren't much smaller"
- Images that are already optimized won't shrink much more
- PNG screenshots compress differently than photos
- Try increasing compression (lowering quality number)
"Picture tags aren't appearing"
- Make sure "Serve WebP" is enabled
- Some page builders bypass WordPress image functions
- Check that your theme uses standard WordPress image output
"Upload failed after enabling plugin"
- Check PHP memory limit—large images need more memory
- ImageMagick might have a timeout on your host
- Try uploading a smaller image to test
Technical Details
Settings stored in: wp_options table, key cpmo_settings
Optimization stats stored in: Post meta _cpmo_optimization_stats on each attachment
What's tracked per image:
- Original file size and type
- Final file size and type
- Actions performed (resize, compress, webp, strip_exif)
- Percentage savings
Processing order:
- Resize (if oversized)
- Compress (if not converting to WebP)
- Strip EXIF (if JPEG)
- Convert to WebP (replaces original, keeps fallback)
- Process thumbnails (same steps)
Libraries used:
- ImageMagick via PHP
Imagickclass (preferred) - GD via PHP
gdextension (fallback) - WordPress
WP_Image_Editorfor compatibility
To uninstall completely:
- Deactivate and delete the plugin
- Settings remain in database by default
- To remove: delete the
cpmo_settingsoption - Optimized images remain optimized (no way to "un-optimize")