Skip to content

Image-Size list shows custom image sizes twice #116

Description

@grappler

Bug Report

Describe the current, buggy behavior

The custom image sizes are listed twice. Once with the correct information and once with the height and width missing.

+-----------------------+-------+--------+------+-------+
| name                  | width | height | crop | ratio |
+-----------------------+-------+--------+------+-------+
| full                  |       |        | N/A  | N/A   |
| large                 | 1024  | 1024   | soft | N/A   |
| medium_large          | 768   | 0      | soft | N/A   |
| medium                | 300   | 300    | soft | N/A   |
| mini-profile-thumb    | 220   | 220    | soft | N/A   |
| thumbnail             | 150   | 150    | hard | 1:1   |
| mini-navigation-thumb | 150   | 20     | soft | N/A   |
| edit-screen-thumb     | 120   | 120    | soft | N/A   |
| mini-frontpage-thumb  | 100   | 50     | soft | N/A   |
| edit-screen-thumb     | 0     | 0      | soft | N/A   |
| mini-profile-thumb    | 0     | 0      | soft | N/A   |
| mini-navigation-thumb | 0     | 0      | soft | N/A   |
| mini-frontpage-thumb  | 0     | 0      | soft | N/A   |
+-----------------------+-------+--------+------+-------+

Describe how other contributors can replicate this bug

  • Register a custom image size add_image_size( 'mini-profile-thumb', 220, 220 );
  • wp media image-size
  • See results

Describe what you would expect as the correct outcome

I expect the result to look as follows

+-----------------------+-------+--------+------+-------+
| name                  | width | height | crop | ratio |
+-----------------------+-------+--------+------+-------+
| full                  |       |        | N/A  | N/A   |
| large                 | 1024  | 1024   | soft | N/A   |
| medium_large          | 768   | 0      | soft | N/A   |
| medium                | 300   | 300    | soft | N/A   |
| mini-profile-thumb    | 220   | 220    | soft | N/A   |
| thumbnail             | 150   | 150    | hard | 1:1   |
| mini-navigation-thumb | 150   | 20     | soft | N/A   |
| edit-screen-thumb     | 120   | 120    | soft | N/A   |
| mini-frontpage-thumb  | 100   | 50     | soft | N/A   |
+-----------------------+-------+--------+------+-------+

Let us know what environment you are running this on

OS:	Linux 3.10.0-1062.4.1.el7.x86_64 #1 SMP Wed Sep 25 09:42:57 EDT 2019 x86_64
Shell:
PHP binary:	/usr/local/bin/php
PHP version:	7.1.32
php.ini used:	/usr/local/etc/php/php.ini
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/app
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:	/app/wp-cli.yml
WP-CLI version:	2.3.0
WordPress version: 5.2.4

Provide a possible solution

The code in the developer handbook is a good solution https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/#comment-730

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions