X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..febc815b2c9d85be5717da9e8d164bd2daa97e31:/wp-admin/includes/image-edit.php?ds=inline diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php index d2d6dc2c..928cd135 100644 --- a/wp-admin/includes/image-edit.php +++ b/wp-admin/includes/image-edit.php @@ -6,6 +6,13 @@ * @subpackage Administration */ +/** + * Loads the WP image-editing interface. + * + * @param int $post_id Post ID. + * @param bool|object $msg Optional. Message to display for image editor updates or errors. + * Default false. + */ function wp_image_editor($post_id, $msg = false) { $nonce = wp_create_nonce("image_editor-$post_id"); $meta = wp_get_attachment_metadata($post_id); @@ -13,7 +20,7 @@ function wp_image_editor($post_id, $msg = false) { $sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']); $note = ''; - if ( is_array($meta) && isset($meta['width']) ) + if ( isset( $meta['width'], $meta['height'] ) ) $big = max( $meta['width'], $meta['height'] ); else die( __('Image data does not exist. Please re-upload the image.') ); @@ -21,8 +28,9 @@ function wp_image_editor($post_id, $msg = false) { $sizer = $big > 400 ? 400 / $big : 1; $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); - $can_restore = !empty($backup_sizes) && isset($backup_sizes['full-orig']) - && $backup_sizes['full-orig']['file'] != basename($meta['file']); + $can_restore = false; + if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) + $can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] ); if ( $msg ) { if ( isset($msg->error) ) @@ -32,69 +40,46 @@ function wp_image_editor($post_id, $msg = false) { } ?> -
-
+
-
-
-
-
-
-
- )" disabled="disabled" class="button-primary imgedit-submit-btn" value="" />
-
- |
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
+
+
|