lsx-design icon indicating copy to clipboard operation
lsx-design copied to clipboard

Registering custom image sizes & aspect ratios via theme.json

Open ashleyshaw opened this issue 2 years ago • 0 comments

Add Additional Image Sizes and Custom Aspect Ratios to LSX Design Theme

Objective: Enhance the LSX Design theme by introducing new image sizes and custom aspect ratios to improve flexibility and ensure consistent visuals across different screen sizes.

New Image Sizes:

  • Small Thumbnail: 180px x 120px (Aspect Ratio: 3:2) — For small previews or sidebar widgets.
  • Medium-Large: 800px x 600px (Aspect Ratio: 4:3) — Ideal for content areas requiring medium-sized visuals.
  • Extra Large: 1600px x 900px (Aspect Ratio: 16:9) — Suitable for high-resolution banners or hero images.

Custom Aspect Ratios:

  • Square: 1:1 — Perfect for avatars, icons, or product thumbnails.
  • Portrait: 3:4 — Useful for displaying vertical images in galleries or listings.
  • Ultra-Wide: 21:9 — Best for cinematic banners and wide-format presentations.

Implementation Steps:

  1. Register these new image sizes and aspect ratios in the theme.json file.
  2. Test the new image sizes and ratios to ensure they render correctly on different devices and screen sizes.
  3. Validate compatibility with WordPress 6.6's custom aspect ratio feature.

References:

Acceptance Criteria:

  • New image sizes and aspect ratios are correctly defined and available in the LSX Design theme.
  • Image rendering is consistent and optimised across all supported devices.

ashleyshaw avatar Oct 10 '24 16:10 ashleyshaw