markdown 使用命令行使用新的图像大小重新生成WordPress图像
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 使用命令行使用新的图像大小重新生成WordPress图像相关的知识,希望对你有一定的参考价值。
## [wp media regenerate](https://developer.wordpress.org/cli/commands/media/regenerate/)
Regenerates thumbnails for one or more attachments.
### OPTIONS
<dl>
<dt>[<attachment-id>…]</dt>
<dd>One or more IDs of the attachments to regenerate.</dd>
<dt>[--image_size=<image_size>]</dt>
<dd>Name of the image size to regenerate. Only thumbnails of this image size will be regenerated, thumbnails of other image sizes will not.</dd>
<dt>[--skip-delete]</dt>
<dd>Skip deletion of the original thumbnails. If your thumbnails are linked from sources outside your control, it’s likely best to leave them around. Defaults to false.</dd>
<dt>[--only-missing]</dt>
<dd>Only generate thumbnails for images missing image sizes.</dd>
<dt>[--yes]</dt>
<dd>Answer yes to the confirmation message. Confirmation only shows when no IDs passed as arguments.</dd>
</dl>
### EXAMPLES
#### Regenerate thumbnails for given attachment IDs.
```bash
$ wp media regenerate 123 124 125
Found 3 images to regenerate.
1/3 Regenerated thumbnails for "Vertical Image" (ID 123).
2/3 Regenerated thumbnails for "Horizontal Image" (ID 124).
3/3 Regenerated thumbnails for "Beautiful Picture" (ID 125).
Success: Regenerated 3 of 3 images.
```
#### Regenerate all thumbnails, without confirmation.
```bash
$ wp media regenerate --yes
Found 3 images to regenerate.
1/3 Regenerated thumbnails for "Sydney Harbor Bridge" (ID 760).
2/3 Regenerated thumbnails for "Boardwalk" (ID 757).
3/3 Regenerated thumbnails for "Sunburst Over River" (ID 756).
Success: Regenerated 3 of 3 images.
```
#### Re-generate all thumbnails that have IDs between 1000 and 2000.
```bash
$ seq 1000 2000 | xargs wp media regenerate
Found 4 images to regenerate.
1/4 Regenerated thumbnails for "Vertical Featured Image" (ID 1027).
2/4 Regenerated thumbnails for "Horizontal Featured Image" (ID 1022).
3/4 Regenerated thumbnails for "Unicorn Wallpaper" (ID 1045).
4/4 Regenerated thumbnails for "I Am Worth Loving Wallpaper" (ID 1023).
Success: Regenerated 4 of 4 images.
```
#### Re-generate only the thumbnails of "large" image size for all images.
```bash
$ wp media regenerate --image_size=large
Do you really want to regenerate the "large" image size for all images? [y/n] y
Found 3 images to regenerate.
1/3 Regenerated "large" thumbnail for "Sydney Harbor Bridge" (ID 760).
2/3 No "large" thumbnail regeneration needed for "Boardwalk" (ID 757).
3/3 Regenerated "large" thumbnail for "Sunburst Over River" (ID 756).
Success: Regenerated 3 of 3 images.
```
### GLOBAL PARAMETERS
These global parameters have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
Argument | Description
--- | ---
--path=<path> | Path to the WordPress files.
--url=<url> | Pretend request came from given URL. In multisite, this argument is how the target site is specified.
--ssh=[<scheme>:][<user>@]<host|container>[:<port>][<path>] | Perform operation against a remote server over SSH (or a container using scheme of “docker”, “docker-compose”, “vagrant”).
--http=<http> | Perform operation against a remote WordPress install over HTTP.
--user=<id|login|email> | Set the WordPress user.
--skip-plugins[=<plugins>] | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded.
--skip-themes[=<themes>] | Skip loading all themes, or a comma-separated list of themes.
--skip-packages | Skip loading all installed packages.
--require=<path> | Load PHP file before running the command (may be used more than once).
--[no-]color | Whether to colorize the output.
--debug[=<group>] | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help.
--prompt[=<assoc>] | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values.
--quiet | Suppress informational messages.
For sites on your local, you can use `wp media regenerate --only-missing --yes`
For Pantheon sites, use Terminus to get CLI access to your site (even live!)
Format: `terminus remote:wp <site>.<env> -- <wp-cli command>`
Example: `terminus remote:wp american-rivers.live -- media regenerate --only-missing --yes`
[More details on the wp media regenerate command](https://developer.wordpress.org/cli/commands/media/regenerate/)
以上是关于markdown 使用命令行使用新的图像大小重新生成WordPress图像的主要内容,如果未能解决你的问题,请参考以下文章
使用 ImageMagick 调整大小,然后从命令行裁剪图像
markdown 在命令行界面上重新格式化可引导USB驱动器。
sh 使用sips命令行Mac OS X调整JPG图像的大小