WordPress.org

Make WordPress Core

Ticket #23733: 23733.2.diff

File 23733.2.diff, 2.7 KB (added by wonderboymusic, 5 years ago)

More of them

  • wp-admin/custom-header.php

    diff --git wp-admin/custom-header.php wp-admin/custom-header.php
    index 7629af3..1228843 100644
    wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> 
    663663                        list( $width, $height, $type, $attr ) = getimagesize( $file );
    664664                } else {
    665665                        $data = wp_get_attachment_metadata( $attachment_id );
    666                         $height = $data[ 'height' ];
    667                         $width = $data[ 'width' ];
     666                        $height = isset( $data[ 'height' ] ) ? $data[ 'height' ] : 0;
     667                        $width = isset( $data[ 'width' ] ) ? $data[ 'width' ] : 0;
    668668                        unset( $data );
    669669                }
    670670
  • wp-admin/includes/image-edit.php

    diff --git wp-admin/includes/image-edit.php wp-admin/includes/image-edit.php
    index b24d4f4..294c95d 100644
    function wp_restore_image($post_id) { 
    499499                                        $delpath = apply_filters('wp_delete_file', $file);
    500500                                        @unlink($delpath);
    501501                                }
    502                         } else {
     502                        } elseif ( isset( $meta['width'], $meta['height'] ) ) {
    503503                                $backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']);
    504504                        }
    505505                }
  • wp-includes/media.php

    diff --git wp-includes/media.php wp-includes/media.php
    index f41f63e..1a00e4f 100644
    function gallery_shortcode($attr) { 
    780780        foreach ( $attachments as $id => $attachment ) {
    781781                $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
    782782                $image_meta  = wp_get_attachment_metadata( $id );
    783                 $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
     783
     784                $orientation = '';
     785                if ( isset( $image_meta['height'], $image_meta['width'] ) )
     786                        $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
    784787
    785788                $output .= "<{$itemtag} class='gallery-item'>";
    786789                $output .= "
  • wp-includes/theme.php

    diff --git wp-includes/theme.php wp-includes/theme.php
    index 8b8f42c..2150b46 100644
    function get_uploaded_header_images() { 
    10131013                $header_images[$header_index]['attachment_id'] =  $header->ID;
    10141014                $header_images[$header_index]['url'] =  $url;
    10151015                $header_images[$header_index]['thumbnail_url'] =  $url;
    1016                 $header_images[$header_index]['width'] = $header_data['width'];
    1017                 $header_images[$header_index]['height'] = $header_data['height'];
     1016                if ( isset( $header_data['width'] ) )
     1017                        $header_images[$header_index]['width'] = $header_data['width'];
     1018                if ( isset( $header_data['height'] ) )
     1019                        $header_images[$header_index]['height'] = $header_data['height'];
    10181020        }
    10191021
    10201022        return $header_images;