wp-cli / media-command

Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
MIT License
44 stars 41 forks source link

Image-Size list shows custom image sizes twice #116

Closed grappler closed 8 months ago

grappler commented 5 years ago

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

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

fliespl commented 2 years ago

I think this is still happening on 2.6.0.