mirror of
https://gh.wpcy.net/https://github.com/wp-cli/handbook.git
synced 2026-04-26 17:55:01 +08:00
38 lines
1.6 KiB
Markdown
38 lines
1.6 KiB
Markdown
# wp media
|
|
|
|
Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
|
|
|
|
### EXAMPLES
|
|
|
|
# Re-generate all thumbnails, without confirmation.
|
|
$ 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.
|
|
|
|
# Import a local image and set it to be the featured image for a post.
|
|
$ wp media import ~/Downloads/image.png --post_id=123 --title="A downloaded picture" --featured_image
|
|
Imported file '/home/person/Downloads/image.png' as attachment ID 1753 and attached to post 123 as featured image.
|
|
Success: Imported 1 of 1 images.
|
|
|
|
# List all registered image sizes
|
|
$ wp media image-size
|
|
+---------------------------+-------+--------+-------+
|
|
| name | width | height | crop |
|
|
+---------------------------+-------+--------+-------+
|
|
| full | | | N/A |
|
|
| twentyfourteen-full-width | 1038 | 576 | hard |
|
|
| large | 1024 | 1024 | soft |
|
|
| medium_large | 768 | 0 | soft |
|
|
| medium | 300 | 300 | soft |
|
|
| thumbnail | 150 | 150 | hard |
|
|
+---------------------------+-------+--------+-------+
|
|
|
|
# Fix orientation for specific images.
|
|
$ wp media fix-orientation 63
|
|
1/1 Fixing orientation for "Portrait_6" (ID 63).
|
|
Success: Fixed 1 of 1 images.
|
|
|
|
|