feat: add atmosphere backdrops and shipped placeholders
About and Projects had a figure floating on a CSS gradient while Music and Podcasts had a whole world behind theirs. They get their own landscape backdrop, which is what made the four read as one series. Adds placeholder art for a release without a cover and a post without a featured image, composited over the per-topic accent so a grid of missing images still varies. Tracks borrow their album cover first. The generated inventory grows to 76 files. Placeholders encode at lower quality because they sit at half opacity behind text, which kept the payload inside its budget instead of raising it again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
32 files changed
+540
-136
No files matched your search
+6
-3
@@ -37,7 +37,10 @@ function chrnx_get_topic_portrait_markup( string $topic_slug, string $alt = '',
|
||||
$markup = '<picture class="chrnx-responsive-portrait"' . $decorative . '>';
|
||||
$markup .= '<source type="image/avif" srcset="' . esc_url( $base_uri . '-384.avif' ) . ' 384w, ' . esc_url( $base_uri . '-768.avif' ) . ' 768w" sizes="' . esc_attr( $sizes ) . '">';
|
||||
$markup .= '<source type="image/webp" srcset="' . esc_url( $base_uri . '-384.webp' ) . ' 384w, ' . esc_url( $base_uri . '-768.webp' ) . ' 768w" sizes="' . esc_attr( $sizes ) . '">';
|
||||
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( get_theme_file_uri( $source ) ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '"' . $priority . ' decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
|
||||
// The fallback is the 768 WebP, not the multi-megabyte master: every browser
|
||||
// that renders <picture> has supported WebP since 2020, and shipping design
|
||||
// masters as a runtime fallback cost megabytes per image.
|
||||
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( $base_uri . '-768.webp' ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '"' . $priority . ' decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
|
||||
$markup .= '</picture>';
|
||||
|
||||
return $markup;
|
||||
@@ -51,7 +54,7 @@ function chrnx_get_topic_portrait_markup( string $topic_slug, string $alt = '',
|
||||
* @return string Safe picture markup or an empty string.
|
||||
*/
|
||||
function chrnx_get_atmosphere_markup( string $asset_key, string $class_name = '' ): string {
|
||||
if ( 'podcast-frequency' !== $asset_key ) {
|
||||
if ( ! in_array( $asset_key, array( 'podcast-frequency', 'about-grunge', 'projects-grunge' ), true ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -73,7 +76,7 @@ function chrnx_get_atmosphere_markup( string $asset_key, string $class_name = ''
|
||||
$markup = '<picture class="chrnx-responsive-atmosphere" aria-hidden="true">';
|
||||
$markup .= '<source type="image/avif" srcset="' . esc_url( $base_uri . '-384.avif' ) . ' 384w, ' . esc_url( $base_uri . '-768.avif' ) . ' 768w, ' . esc_url( $base_uri . '-1536.avif' ) . ' 1536w" sizes="' . esc_attr( $sizes ) . '">';
|
||||
$markup .= '<source type="image/webp" srcset="' . esc_url( $base_uri . '-384.webp' ) . ' 384w, ' . esc_url( $base_uri . '-768.webp' ) . ' 768w, ' . esc_url( $base_uri . '-1536.webp' ) . ' 1536w" sizes="' . esc_attr( $sizes ) . '">';
|
||||
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( get_theme_file_uri( $source ) ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '" decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
|
||||
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( $base_uri . '-1536.webp' ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '" decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
|
||||
$markup .= '</picture>';
|
||||
|
||||
return $markup;
|
||||
|
||||
Reference in new issue
Block a user