From 815e3ffbe6d0d49189c8a35df5243560f12f9052 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 15 Jun 2019 16:23:28 +0000 Subject: [PATCH] After [45538]: fix another WPCS "strict comparison" fix. Props birgire. See #40439. git-svn-id: https://develop.svn.wordpress.org/trunk@45540 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/image.php | 34 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php index 5b667f4ab5..03fecac871 100644 --- a/src/wp-admin/includes/image.php +++ b/src/wp-admin/includes/image.php @@ -781,25 +781,27 @@ function _load_image_to_edit_path( $attachment_id, $size = 'full' ) { $filepath = get_attached_file( $attachment_id ); if ( $filepath && file_exists( $filepath ) ) { - $data = image_get_intermediate_size( $attachment_id, $size ); + if ( 'full' !== $size ) { + $data = image_get_intermediate_size( $attachment_id, $size ); - if ( 'full' != $size && $data ) { - $filepath = path_join( dirname( $filepath ), $data['file'] ); + if ( $data ) { + $filepath = path_join( dirname( $filepath ), $data['file'] ); - /** - * Filters the path to the current image. - * - * The filter is evaluated for all image sizes except 'full'. - * - * @since 3.1.0 - * - * @param string $path Path to the current image. - * @param string $attachment_id Attachment ID. - * @param string $size Size of the image. - */ - $filepath = apply_filters( 'load_image_to_edit_filesystempath', $filepath, $attachment_id, $size ); + /** + * Filters the path to the current image. + * + * The filter is evaluated for all image sizes except 'full'. + * + * @since 3.1.0 + * + * @param string $path Path to the current image. + * @param string $attachment_id Attachment ID. + * @param string $size Size of the image. + */ + $filepath = apply_filters( 'load_image_to_edit_filesystempath', $filepath, $attachment_id, $size ); + } } - } elseif ( function_exists( 'fopen' ) && true === ini_get( 'allow_url_fopen' ) ) { + } elseif ( function_exists( 'fopen' ) && ini_get( 'allow_url_fopen' ) ) { /** * Filters the image URL if not in the local filesystem. *