Ticket #49889: 49889.diff
File 49889.diff, 3.2 KB (added by , 5 years ago) |
---|
-
image.php
93 93 // Use the originally uploaded image dimensions as full_width and full_height. 94 94 if ( ! empty( $image_meta['original_image'] ) ) { 95 95 $image_file = wp_get_original_image_path( $attachment_id ); 96 $imagesize = @getimagesize( $image_file ); 96 97 if( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 98 $imagesize = getimagesize( $image_file ); 99 } else { 100 $imagesize = @getimagesize( $image_file ); 101 } 102 97 103 } 98 104 99 105 if ( ! empty( $imagesize ) ) { … … 224 230 * @return array The image attachment meta data. 225 231 */ 226 232 function wp_create_image_subsizes( $file, $attachment_id ) { 227 $imagesize = @getimagesize( $file ); 233 234 if( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 235 $imagesize = getimagesize( $file ); 236 } else { 237 $imagesize = @getimagesize( $file ); 238 } 228 239 229 240 if ( empty( $imagesize ) ) { 230 241 // File is not an image. … … 687 698 return false; 688 699 } 689 700 690 list( , , $image_type ) = @getimagesize( $file ); 701 if( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 702 list( , , $image_type ) = getimagesize( $file ); 703 } else { 704 list( , , $image_type ) = @getimagesize( $file ); 705 } 691 706 692 707 /* 693 708 * EXIF contains a bunch of data we'll probably never need formatted in ways … … 716 731 * as caption, description etc. 717 732 */ 718 733 if ( is_callable( 'iptcparse' ) ) { 719 @getimagesize( $file, $info ); 734 735 if( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 736 getimagesize( $file, $info ); 737 } else { 738 @getimagesize( $file, $info ); 739 } 720 740 721 741 if ( ! empty( $info['APP13'] ) ) { 722 $iptc = @iptcparse( $info['APP13'] ); 742 743 if( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 744 $iptc = iptcparse( $info['APP13'] ); 745 } else { 746 $iptc = @iptcparse( $info['APP13'] ); 747 } 723 748 724 749 // Headline, "A brief synopsis of the caption". 725 750 if ( ! empty( $iptc['2#105'][0] ) ) { … … 779 804 $exif_image_types = apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ); 780 805 781 806 if ( is_callable( 'exif_read_data' ) && in_array( $image_type, $exif_image_types, true ) ) { 782 $exif = @exif_read_data( $file ); 807 808 if( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 809 $exif = exif_read_data( $file ); 810 } else { 811 $exif = @exif_read_data( $file ); 812 } 783 813 784 814 if ( ! empty( $exif['ImageDescription'] ) ) { 785 815 mbstring_binary_safe_encoding(); … … 877 907 * @return bool True if valid image, false if not valid image. 878 908 */ 879 909 function file_is_valid_image( $path ) { 880 $size = @getimagesize( $path ); 910 911 if( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 912 $size = getimagesize( $path ); 913 } else { 914 $size = @getimagesize( $path ); 915 } 916 881 917 return ! empty( $size ); 882 918 } 883 919 … … 892 928 function file_is_displayable_image( $path ) { 893 929 $displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_ICO ); 894 930 895 $info = @getimagesize( $path ); 931 if( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 932 $info = getimagesize( $path ); 933 } else { 934 $info = @getimagesize( $path ); 935 } 936 896 937 if ( empty( $info ) ) { 897 938 $result = false; 898 939 } elseif ( ! in_array( $info[2], $displayable_image_types, true ) ) {