wp-cli / media-command

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

Can't regenerate images listed in wp media image-size #160

Closed oivinds closed 1 year ago

oivinds commented 2 years ago

bash-5.1$ wp media image-size +-------------------------+-------+--------+------+-------+ | name | width | height | crop | ratio | +-------------------------+-------+--------+------+-------+ | full | | | N/A | N/A | | 2048x2048 | 2048 | 2048 | soft | N/A | | twentytwenty-fullscreen | 1980 | 9999 | soft | N/A | | 1536x1536 | 1536 | 1536 | soft | N/A | | post-thumbnail | 1200 | 9999 | soft | N/A | | large | 1024 | 1024 | soft | N/A | | medium_large | 768 | 0 | soft | N/A | | medium | 300 | 300 | soft | N/A | | thumbnail | 150 | 150 | hard | 1:1 | | 1536x1536 | 0 | 0 | soft | N/A | | 2048x2048 | 0 | 0 | soft | N/A | | post-thumbnail | 0 | 0 | soft | N/A | | twentytwenty-fullscreen | 0 | 0 | soft | N/A | +-------------------------+-------+--------+------+-------+

bash-5.1$ wp media regenerate --image_size=twentytwenty-fullscreen Error: Unknown image size "twentytwenty-fullscreen". bash-5.1$ wp media regenerate --image_size=twentytwenty-fullscreen

I can only regenerate wordpress core default image sizes, like thumbnail, large and so.

danielbachhuber commented 2 years ago

@oivinds I'm unable to reproduce this issue.

Here's what I did on a fresh WordPress install:

$ wp theme install --activate twentytwenty
Warning: twentytwenty: Theme already installed.
Activating 'twentytwenty'...
Success: Switched to 'Twenty Twenty' theme.
Success: Theme already installed.
$ wp media regenerate --image_size=twentytwenty-fullscreen
Do you really want to regenerate the "twentytwenty-fullscreen" image size for all images? [y/n] y
Found 1 image to regenerate.
1/1 Regenerated "twentytwenty-fullscreen" thumbnail for "4562c8dae9200058.53404593" (ID 5).
Success: Regenerated 1 of 1 images.

It looks like twentytwenty-fullscreen is registered twice for me too:

$ wp media image-size
+-------------------------+-------+--------+------+-------+
| name                    | width | height | crop | ratio |
+-------------------------+-------+--------+------+-------+
| full                    |       |        | N/A  | N/A   |
| 2048x2048               | 2048  | 2048   | soft | N/A   |
| twentytwenty-fullscreen | 1980  | 9999   | soft | N/A   |
| 1536x1536               | 1536  | 1536   | soft | N/A   |
| post-thumbnail          | 1200  | 9999   | soft | N/A   |
| large                   | 1024  | 1024   | soft | N/A   |
| medium_large            | 768   | 0      | soft | N/A   |
| medium                  | 300   | 300    | soft | N/A   |
| thumbnail               | 150   | 150    | hard | 1:1   |
| 1536x1536               | 0     | 0      | soft | N/A   |
| 2048x2048               | 0     | 0      | soft | N/A   |
| post-thumbnail          | 0     | 0      | soft | N/A   |
| twentytwenty-fullscreen | 0     | 0      | soft | N/A   |
+-------------------------+-------+--------+------+-------+

Can you see if the issue reproduces on a fresh WordPress install?