wp_image_editor
函数
wp_image_editor ( $post_id, $msg = false )
- 参数
-
-
(int)
$post_id
Attachment post ID.- Required: 是
-
(false|object)
$msg
Optional. Message to display for image editor updates or errors. Default false.- Required: 否
- Default: false
-
(int)
- 定义位置
-
-
wp-admin/includes/image-edit.php
, line 18
-
wp-admin/includes/image-edit.php
- 引入
- 2.9.0
- 弃用
- –
加载WP图像编辑界面。
function wp_image_editor( $post_id, $msg = false ) { $nonce = wp_create_nonce( "image_editor-$post_id" ); $meta = wp_get_attachment_metadata( $post_id ); $thumb = image_get_intermediate_size( $post_id, 'thumbnail' ); $sub_sizes = isset( $meta['sizes'] ) && is_array( $meta['sizes'] ); $note = ''; if ( isset( $meta['width'], $meta['height'] ) ) { $big = max( $meta['width'], $meta['height'] ); } else { die( __( 'Image data does not exist. Please re-upload the image.' ) ); } $sizer = $big > 400 ? 400 / $big : 1; $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); $can_restore = false; if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) { $can_restore = wp_basename( $meta['file'] ) !== $backup_sizes['full-orig']['file']; } if ( $msg ) { if ( isset( $msg->error ) ) { $note = ""; } elseif ( isset( $msg->msg ) ) { $note = "$msg->error
"; } } $edit_custom_sizes = false; /** * Filters whether custom sizes are available options for image editing. * * @since 6.0.0 * * @param bool|string[] $edit_custom_sizes True if custom sizes can be edited or array of custom size names. */ $edit_custom_sizes = apply_filters( 'edit_custom_thumbnail_sizes', $edit_custom_sizes ); ?>$msg->msg
<?php })" disabled="disabled" class="button button-primary imgedit-submit-btn" value="" /><?php printf( /* translators: %s: Image width and height in pixels. */ __( 'Original dimensions %s' ), '' . $meta['width'] . ' × ' . $meta['height'] . '' ); ?>
, 'restore')" class="button button-primary" value="" />
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。