+
+
- ×
+ ×
!
, 'scale')" class="button-primary" value="" />
@@ -499,7 +502,7 @@ function wp_restore_image($post_id) {
$delpath = apply_filters('wp_delete_file', $file);
@unlink($delpath);
}
- } else {
+ } elseif ( isset( $meta['width'], $meta['height'] ) ) {
$backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']);
}
}
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 1d6d91a6b3..573c4db2ab 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -1127,7 +1127,7 @@ function get_media_item( $attachment_id, $args = null ) {
$media_dims = '';
$meta = wp_get_attachment_metadata( $post->ID );
- if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) )
+ if ( isset( $meta['width'], $meta['height'] ) )
$media_dims .= "
{$meta['width']} × {$meta['height']} ";
$media_dims = apply_filters( 'media_meta', $media_dims, $post );
@@ -2368,7 +2368,7 @@ function attachment_submitbox_metadata() {
$media_dims = '';
$meta = wp_get_attachment_metadata( $post->ID );
- if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) )
+ if ( isset( $meta['width'], $meta['height'] ) )
$media_dims .= "
{$meta['width']} × {$meta['height']} ";
$media_dims = apply_filters( 'media_meta', $media_dims, $post );
diff --git a/wp-includes/media.php b/wp-includes/media.php
index 9ba8e295ec..ab2cf3e334 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -164,7 +164,7 @@ function image_downsize($id, $size = 'medium') {
$is_intermediate = true;
}
}
- if ( !$width && !$height && isset($meta['width'], $meta['height']) ) {
+ if ( !$width && !$height && isset( $meta['width'], $meta['height'] ) ) {
// any other type: use the real image
$width = $meta['width'];
$height = $meta['height'];
@@ -780,7 +780,10 @@ function gallery_shortcode($attr) {
foreach ( $attachments as $id => $attachment ) {
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
$image_meta = wp_get_attachment_metadata( $id );
- $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
+
+ $orientation = '';
+ if ( isset( $image_meta['height'], $image_meta['width'] ) )
+ $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "
@@ -1626,12 +1629,13 @@ function wp_prepare_attachment_for_js( $attachment ) {
}
}
- $sizes['full'] = array(
- 'height' => $meta['height'],
- 'width' => $meta['width'],
- 'url' => $attachment_url,
- 'orientation' => $meta['height'] > $meta['width'] ? 'portrait' : 'landscape',
- );
+ $sizes['full'] = array( 'url' => $attachment_url );
+
+ if ( isset( $meta['height'], $meta['width'] ) ) {
+ $sizes['full']['height'] = $meta['height'];
+ $sizes['full']['width'] = $meta['width'];
+ $sizes['full']['orientation'] = $meta['height'] > $meta['width'] ? 'portrait' : 'landscape';
+ }
$response = array_merge( $response, array( 'sizes' => $sizes ), $sizes['full'] );
}
diff --git a/wp-includes/theme.php b/wp-includes/theme.php
index 8b8f42c8fc..2150b46ecd 100644
--- a/wp-includes/theme.php
+++ b/wp-includes/theme.php
@@ -1013,8 +1013,10 @@ function get_uploaded_header_images() {
$header_images[$header_index]['attachment_id'] = $header->ID;
$header_images[$header_index]['url'] = $url;
$header_images[$header_index]['thumbnail_url'] = $url;
- $header_images[$header_index]['width'] = $header_data['width'];
- $header_images[$header_index]['height'] = $header_data['height'];
+ if ( isset( $header_data['width'] ) )
+ $header_images[$header_index]['width'] = $header_data['width'];
+ if ( isset( $header_data['height'] ) )
+ $header_images[$header_index]['height'] = $header_data['height'];
}
return $header_images;