The Image 404 Fallback module automatically replaces 404 (not found) image requests with a configurable fallback image, improving user experience and preventing broken image displays. It intelligently handles both direct file requests and image style derivative requests, ensuring consistent results across your site.
Features
- Automatically detects 404 image requests (including image style derivatives)
- Serves a configurable fallback image
- Supports multiple image formats (JPG, PNG, GIF, WebP, SVG, BMP, ICO, AVIF)
- Includes default fallback images (SVG and PNG)
- Configurable fallback path via admin interface
- Image style aware: Applies requested image styles to fallback images for derivative requests, ensuring correct dimensions and effects
- Handles both direct file requests and image style derivative requests
- Proper HTTP headers and browser caching (200 status code instead of 404)
- Security-aware: Respects Drupal's image style security tokens
- Graceful fallback for image processing failures
How It Works
The module uses Symfony event subscribers to intercept HTTP requests for missing images:
- Catches 404 exceptions for direct image file requests
- Detects and applies image styles to fallback images for derivative requests (e.g.,
/styles/thumbnail/public/missing.jpg) - Serves styled fallbacks with correct dimensions and effects when using raster formats (PNG, JPG, GIF, etc.)
- Gracefully handles SVG and other non-processable formats by serving the raw fallback
- Respects Drupal's access control and security protocols
Post-Installation
- Navigate to Configuration > Media > Image 404 Fallback Settings (
/admin/config/media/image-404-fallback) - Optionally specify a custom fallback image path:
- Enter an absolute path (e.g.,
/var/www/html/sites/default/files/my-fallback.png) - Or a path relative to the Drupal root (e.g.,
sites/default/files/fallback.png) - For styled fallbacks, use raster formats (PNG, JPG, GIF, WebP) rather than SVG
- Enter an absolute path (e.g.,
- If left empty, the module will use its default fallback image located at
images/placeholder.svg
Requirements
- Drupal 10.x or 11.x
- PHP 8.1 or higher
Project information
- Project categories: Administration tools, Content display
30 sites report using this module
- Created by luongosb on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.

