Pattern: Photo and video ratios, cropping and placeholders

Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.

Search terms: aspect ratio, image crop, thumbnail, grid, feed, webp, blurhash placeholder, layout shift, cls, exif removal, video duration limit, responsive images

Last reviewed:

For agents

1. Problem

Owners ask for “photos that look right” without stating ratios. Without rules, feed cards jump while loading, grids show random crops, huge originals waste bandwidth, and photos leak the location where they were taken.

2. Options

Topic Option Upside Downside
Ratios Free ratio everywhere No cropping Cards of every height; messy grids; extreme panoramas
Ratios Limited range plus crop step (recommended) Predictable layout Users must accept a crop for extreme images
Ratios One fixed ratio Simplest Loses the composition of many photos
Format WebP variants Smaller files than PNG or JPEG at similar quality (Google WebP documentation) Very old clients; keep a fallback if you need it
Placeholder Blurred tiny preview (BlurHash-style) Box looks filled before the image arrives Extra field per image
Placeholder Solid colour Cheapest Less pleasant

4. Scenarios and edge cases

5. Common mistakes

6. How to audit

Sources