Pictures Configuration
Configure image handling and sizes through the Combo plugin.
Pictures Configuration Options
The pictures section in your config.yml file controls image handling and sizes:
1pictures:2yearmonth_folders: true # Organize uploads by year/month34placeholder: # Image placeholder settings5text: 'No image'67thumbnail: # Default thumbnail size8width: 1509height: 15010crop: true1112sizes: # Custom image sizes13medium:14width: 76815height: 016crop: false17large:18width: 120019height: 020crop: false21hero:22width: 192023height: 60024crop: true25square:26width: 40027height: 40028crop: true
Upload Organization
yearmonth_folders
Controls whether uploads are organized into year/month folders. Set to true to organize uploads by year/month, or false to place all uploads in a single folder.
1pictures:2yearmonth_folders: true # Organize uploads by year/month
Placeholder Settings
placeholder
Controls the text displayed in image placeholders when no image is available.
1pictures:2placeholder:3text: 'No image available'
Default Thumbnail Size
thumbnail
Controls the default thumbnail size. This overrides the WordPress default thumbnail size.
1pictures:2thumbnail:3width: 1504height: 1505crop: true
Parameters:
- width: Width in pixels
- height: Height in pixels
- crop: Whether to crop the image to exact dimensions (
true) or maintain aspect ratio (false)
Custom Image Sizes
sizes
Defines custom image sizes for your theme. These sizes are generated when images are uploaded.
1pictures:2sizes:3medium: # Override default medium size4width: 7685height: 06crop: false78large: # Override default large size9width: 120010height: 011crop: false1213hero: # Custom hero image size14width: 192015height: 60016crop: true1718square: # Custom square image size19width: 40020height: 40021crop: true2223portrait: # Custom portrait image size24width: 40025height: 60026crop: true
Each size can have the following parameters:
- width: Width in pixels
- height: Height in pixels (set to 0 to maintain aspect ratio)
- crop: Whether to crop the image to exact dimensions
Using Custom Image Sizes
Once custom image sizes are defined, you can use them in your theme:
1<?php2// Get the featured image in the 'hero' size3the_post_thumbnail('hero');45// Get an image URL in the 'square' size6$image_url = wp_get_attachment_image_url($attachment_id, 'square');78// Using with Combo utility functions9cbo_acf_img($image, 'hero');10?>
Best Practices
- Define image sizes based on how they'll be used in your theme
- Use descriptive names for custom image sizes
- Consider performance when defining image sizes
- Use crop mode only when exact dimensions are required
- Set height to 0 to maintain aspect ratio when only width matters