WordPress.org

Making WordPress.org

Changeset 3670


Ignore:
Timestamp:
07/12/2016 04:48:41 PM (4 years ago)
Author:
obenland
Message:

Plugin Directory: Add fallback to high res icon.

See https://make.wordpress.org/meta/2016/07/12/plugin-directory-v3-open-beta/#comment-8387

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r3545 r3670  
    233233        }
    234234
     235        // Fallback to SVG if it exists.
    235236        if ( ! $icon && $svg ) {
    236237            $icon = $svg;
     238        }
     239
     240        // Fallback to 2x if it exists.
     241        if ( ! $icon && $icon_2x ) {
     242            $icon = $icon_2x;
    237243        }
    238244
     
    257263                $id    = "plugin-icon-{$plugin_slug}";
    258264                $html  = "<style type='text/css'>";
    259                 $html .= "#{$id} { background-image: url('{$icon}'); } .plugin-icon { background-size: 128px 128px; height: 128px; width: 128px; }";
     265                $html .= "#{$id} { background-image: url('{$icon}'); } .plugin-icon { background-size: cover; height: 128px; width: 128px; }";
    260266                if ( ! empty( $icon_2x ) && ! $generated ) {
    261267                    $html .= "@media only screen and (-webkit-min-device-pixel-ratio: 1.5) { #{$id} { background-image: url('{$icon_2x}'); } }";
Note: See TracChangeset for help on using the changeset viewer.