games:process-screenshots
Processes and optimizes game screenshots for web display.
Overview
This command processes game screenshots by converting them to optimized WebP format, resizing them for consistent display, and generating thumbnails. It helps improve website performance by reducing image file sizes while maintaining visual quality.
Usage
php artisan games:process-screenshots [options]
Options
- --force
- Process screenshots even if they already exist.
- --game-id=ID
- ID of the specific game to process.
- --game-name=NAME
- Name (or part of name) of the game(s) to process.
- --all
- Process all visible games with screenshots.
- --quality=QUALITY
- WebP quality (0-100) (default: 80).
Processing Logic
The command follows this workflow:
- Identifies games with screenshots to process
- Downloads original images if not already cached
- Converts to WebP format with specified quality
- Resizes images to standard dimensions
- Generates thumbnails for gallery views
- Optimizes file sizes while preserving quality
- Updates database records with processed image paths
Examples
php artisan games:process-screenshots --game-id=123
Processes screenshots for game ID 123.
php artisan games:process-screenshots --game-id=123 --quality=90
Processes with higher quality settings (larger files).
php artisan games:process-screenshots --game-id=123 --force
Reprocesses screenshots even if they already exist.
php artisan games:process-screenshots --all
Processes screenshots for all games (may take considerable time).
When to Use
Recommended Usage Scenarios
- After importing new games with screenshots
- When optimizing website performance
- After changing image quality settings
- During initial setup or migration
- When storage space needs optimization
Image Processing
The command performs several image optimizations:
Format Conversion
- WebP Output: Modern format with superior compression
- Quality Control: Configurable quality vs. file size balance
- Fallback Support: Maintains compatibility with older browsers
Size Optimization
- Standard Dimensions: Consistent sizing for layout
- Responsive Variants: Multiple sizes for different displays
- Thumbnail Generation: Small previews for galleries
Quality Enhancement
- Sharpening: Improves clarity after resizing
- Color Optimization: Maintains color accuracy
- Compression: Reduces file size without visible quality loss
Quality Settings
Different quality settings provide different trade-offs:
Quality 60-70
- Use Case: Maximum compression for bandwidth-limited environments
- File Size: Smallest files
- Visual Quality: Acceptable for thumbnails
Quality 80 (Default)
- Use Case: Balanced compression for general use
- File Size: Good compression ratio
- Visual Quality: High quality for most purposes
Quality 90-100
- Use Case: Maximum quality for detailed screenshots
- File Size: Larger files
- Visual Quality: Excellent for detailed viewing
Output Formats
The processing generates multiple image variants:
Full Size Images
- Format: WebP with specified quality
- Dimensions: Optimized for detail viewing
- Use: Game detail pages and lightboxes
Medium Images
- Format: WebP with balanced compression
- Dimensions: Suitable for gallery displays
- Use: Screenshot galleries and previews
Thumbnails
- Format: WebP with higher compression
- Dimensions: Small previews
- Use: Game cards and quick previews
Storage Organization
Processed images are organized efficiently:
storage/
├── screenshots/
│ ├── full/
│ │ └── game-123-screenshot-1.webp
│ ├── medium/
│ │ └── game-123-screenshot-1.webp
│ └── thumbnails/
│ └── game-123-screenshot-1.webp
Warning: Processing all screenshots can consume significant CPU, memory, and storage resources. Monitor system performance during large batch operations.
Related Commands
- games:process-thumbnails: Process game thumbnails
- games:refresh: Download new screenshots for processing