Make WordPress Core


Ignore:
Timestamp:
02/02/2021 04:51:17 PM (3 years ago)
Author:
antpb
Message:

Media: Avoid suppressing errors when using getimagesize().

Previously, all logic utilizing getimagesize() was supressing errors making it difficult to debug usage of the function.

A new wp_getimagesize() function has been added to allow the errors to no longer be suppressed when WP_DEBUG is enabled.

Props Howdy_McGee, SergeyBiryukov, mukesh27, davidbaumwald, noisysocks, hellofromTonya.
Fixes #49889.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-custom-image-header.php

    r49384 r50146  
    792792
    793793        if ( file_exists( $file ) ) {
    794             list( $width, $height, $type, $attr ) = @getimagesize( $file );
     794            list( $width, $height, $type, $attr ) = wp_getimagesize( $file );
    795795        } else {
    796796            $data   = wp_get_attachment_metadata( $attachment_id );
     
    12241224        $url        = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
    12251225
    1226         $size       = @getimagesize( $cropped );
     1226        $size       = wp_getimagesize( $cropped );
    12271227        $image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
    12281228
Note: See TracChangeset for help on using the changeset viewer.