menu_book Navigation menu

Asset Management

Pragma CMS treats media files as structured data, not just files on a disk.

The Upload Pipeline

  • Master Normalization: To prevent server bloat, oversized images (e.g., 6000px photos straight from a smartphone) are automatically resized to a sensible maximum (2560px) and auto-oriented before being saved as the "Source of Truth".
  • Variant Generation: The system utilizes Imagick (or GD as a fallback) to generate pre-defined bounding boxes (Thumbnail, Medium, Large, Xlarge, Social).
  • Modern Formats: During generation, the CMS automatically creates highly compressed WebP and AVIF versions of the image alongside the standard JPEG/PNG.

The renderImage() Engine

In your templates, calling renderImage($mediaId) does not output a simple <img> tag. It generates a complete HTML5 <picture> element containing:

  • <source> tags for AVIF and WebP formats.
  • A comprehensive srcset and sizes attribute, allowing the visitor's browser to download the exact pixel density needed for their screen (Retina support).
  • Explicit width and height attributes matching the exact physical pixels of the image, completely eliminating Cumulative Layout Shift (CLS) for optimal SEO performance.