1. Deconstruct the Request:
* Topic: Image CDN Governance.
* Key Components: Formats, Art Direction, Alt Text Rules.
* Goal: Design a system/policy.
-
Analyze the "Why" (Context):
- Why do we need image CDN governance? Performance (Core Web Vitals), consistency, SEO (Search Engine Optimization), accessibility (a11y), and maintainability.
- Who is the audience for this document? Developers, Content Editors, UX/UI Designers.
-
Flesh out Component 1: Formats (Technical Standards):
- Current Best Practice: What should we serve? WebP and AVIF are the modern standards. JPEG/PNG are the fallbacks.
- Workflow: We shouldn't upload WebP usually; we should upload high-quality sources and let the CDN transform them.
- Source Files: RAW/TIFF are too heavy. High-res JPEG/PNG.
- Compression: Need a standard quality setting (e.g., Q=80) to balance size and visual fidelity.
- Vector vs. Raster: SVGs for icons/logos. Don't rasterize text.
-
Flesh out Component 2: Art Direction (Responsive Behavior):
- The Problem: A landscape hero image on desktop looks bad as a tiny square on mobile.
- The Solution:
srcset, sizes, and the <picture> element.
- Breakpoints: Define standard breakpoints (e.g., Mobile, Tablet, Desktop).
- Cropping: Who does it? Automation vs. Manual. "Smart Crop" is good for content, manual is needed for heroes.
- Aspect Ratios: Define standard ratios (16:9, 4:3, 1:1) so layouts don't shift (CLS).
-
Flesh out Component 3: Alt Text Rules (Accessibility & SEO):
- The Golden Rule: Describe the function or content of the image, not just "Image of..."
- Decorative vs. Informative: Null alt (
alt="") for decorative images. Descriptive text for informative ones.
- Character Limits: ~125 characters is a good rule of thumb.
- SEO: Don't keyword stuff.
- Workflow: Make it mandatory in the CMS.
-
Structure the "Governance" Document:
- Introduction/Philosophy: Why does this exist?
- Section 1: Technical Standards (Formats & Compression)
- Section 2: Art Direction (Sizing & Layouts)
- Section 3: Accessibility & Metadata (Alt Text)
- Section 4: Implementation/Enforcement (How to actually do it)
-
Drafting the Content - Iteration & Refinement:
- Refining Formats: Make sure to mention "Upload high quality, serve optimized." Mention AVIF specifically as the future-proofing step.
- Refining Art Direction: Introduce the concept of "Image Slots." A hero image has different rules than a thumbnail.
- Refining Alt Text: Create a simple decision tree or checklist. It helps users understand how to write it.
-
Adding a "Governance Layer":
- It's not just rules; it's enforcement.
- Linting (CI/CD checks).
- CMS validation (cannot publish without alt text).
- Monitoring (Core Web Vitals).
-
Final Review against the Prompt:
- Did I cover Formats? Yes.
- Did I cover Art Direction? Yes.
- Did I cover Alt Text? Yes.
- Is it a "Governance" design? Yes, it includes policy and enforcement.
-
Formatting: Use bolding, lists, and clear headings to make it readable as a technical specification or a policy document. (Self-correction: Ensure the distinction between source formats and delivery formats is clear).
-
Output Generation: (This aligns with the provided good response).
Designing an Image CDN Governance policy requires balancing three competing interests: Performance (load times), Quality (visual fidelity), and Accessibility/SEO (context and searchability).
Below is a comprehensive governance framework designed for a modern web infrastructure.
Image CDN Governance Framework
1. File Format & Encoding Standards
The goal is to serve the smallest possible file that maintains acceptable visual quality, leveraging modern compression algorithms.
Source File Rules (Ingest)
- Prohibited Formats: GIF (for animation, convert to video), BMP, TIFF, uncompressed PNG.
- Accepted Source Formats:
- JPEG: For photographs/originals with high color depth.
- PNG: Only for images requiring transparency or hard edges (logos, diagrams).
- SVG: For icons and simple illustrations (must be sanitized before ingestion).
- Max File Size: No single source image shall exceed 5MB.
Delivery Rules (Output)
The CDN should automatically transcode source files into optimized formats based on the requesting user-agent (Accept headers).
| Priority | Format | Use Case | Browser Support |
|---|
| 1 (Best) | AVIF | Photographs, complex graphics. Offers 50% better compression than WebP. | Chrome, Firefox, Safari (macOS Sonoma+) |
| 2 (Better) | WebP | Fallback for AVIF. Superior to legacy formats. | All modern browsers |
| 3 (Fallback) | JPEG/PNG | Legacy fallback for Internet Explorer or old bots. | Universal |
Compression Policy:
- Lossy (Photos): Set CDN quality to
q=75 (target). This is the "sweet spot" for size/quality.
- Lossless (UI/Text): Use PNG source or lossless WebP/AVIF.
- Metadata Stripping: All EXIF data must be stripped at the CDN edge except for Copyright fields and Orientation (rotation must be baked in, not relied upon via metadata).
2. Art Direction & Responsive Strategy
Art direction ensures the image serves the user's context (device, screen size, bandwidth), not just the browser window.
The "Srcset" Governance
We do not serve the same image to a watch and a 4K monitor.
- Breakpoints: Images must be generated at standard widths:
320w, 640w, 768w, 1024w, 1280w, 1536w, 1920w.
- Client Hints: The CDN must rely on the
Width or Viewport-Width headers (Client Hints) to select the right resource if available; otherwise, fall back to w descriptors in srcset.
Aspect Ratio & Layout Integrity
To prevent Cumulative Layout Shift (CLS), image slots in the UI must reserve space before the image loads.
- Fixed Slots: Define the aspect ratio in CSS (e.g.,
aspect-ratio: 16/9).
- Smart Cropping: If an image does not match the requested aspect ratio, the CDN must use focal point cropping (gravity) rather than center cropping to ensure the subject remains in frame.
The "Mobile First" Rule
- Desktop: Full-width hero images allowed.
- Mobile: No full-width hero images > 100kb.
- Density: Serve
1x images to mobile devices by default (saving bandwidth), and 2x only to high-DPR (Device Pixel Ratio) desktops.
3. Alt Text & Accessibility Rules
This is the content governance layer. This cannot be automated by the CDN alone but can be enforced via the CMS (Content Management System).
The "Mandatory Alt" Policy
- Rule: The
alt attribute is required for all <img> tags.
- CMS Enforcement:
- If the image is functional (a button or link), the field is mandatory.
- If the image is decorative, the user must check a "Decorative" box (which injects
alt=""), preventing screen readers from announcing it.
Writing Guidelines (for Content Editors)
- Be Descriptive, Not Literal: Don't write "Image of a dog." Write "Golden Retriever catching a frisbee in a park."
- No "Image of" Prefixes: Screen readers already announce it is an image.
- Functional Context: If the image is a link to "Contact Us," the alt text must be "Contact Us," not "Phone icon."
- Character Limit: Aim for < 125 characters. If the image contains a complex chart, the alt text should summarize the trend, and a full data table should be linked below.
4. Caching & Cache Control
- Immutable Assets: All image URLs must include a fingerprint/hash in the filename (e.g.,
logo-a1b2c3d4.png).
- Cache-Control:
public, max-age=31536000, immutable. This tells the browser: "This file will never change; don't ask the server again until next year."
- Invalidation: To update an image, you must upload a new file (generating a new hash). Never overwrite an existing file with the same name.
5. Implementation Checklist (For Developers)
Here is how these rules translate into code:
The Ideal HTML Output:
<picture>
<!-- Modern Format for Modern Browsers -->
<source
type="image/avif"
srcset="
img/hero-320w.avif 320w,
img/hero-640w.avif 640w,
img/hero-1024w.avif 1024w
"
sizes="100vw">
<!-- Fallback Format -->
<source
type="image/webp"
srcset="
img/hero-320w.webp 320w,
img/hero-640w.webp 640w
"
sizes="100vw">
<!-- Legacy Fallback + Accessibility -->
<img
src="img/hero-640w.jpg"
srcset="img/hero-640w.jpg 640w, img/hero-1024w.jpg 1024w"
sizes="100vw"
alt="Team members collaborating over a digital whiteboard"
width="640" <!-- Layout shift prevention -->
height="360" <!-- Layout shift prevention -->
loading="lazy" <!-- Performance governance -->
decoding="async"
>
</picture>
Summary of Key Performance Indicators (KPIs)
To govern this policy, monitor these metrics:
- AVIF/WebP Hit Rate: Target > 90% of images served should be next-gen formats.
- CLS Score: Target < 0.1 for all image-heavy pages.
- Alt Text Coverage: Target 100% of
<img> tags have valid alt text (audited via crawler).