From 2b14e7cb0602c98c4fd7d1956cf89299d3c83106 Mon Sep 17 00:00:00 2001 From: selul Date: Wed, 27 Mar 2019 11:46:17 +0200 Subject: [PATCH] fix: cropping behaviour being inconsistent with due to variable reset in image parsing loop --- inc/tag_replacer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/tag_replacer.php b/inc/tag_replacer.php index 1349a2c2..1c046906 100644 --- a/inc/tag_replacer.php +++ b/inc/tag_replacer.php @@ -67,6 +67,7 @@ public function process_image_tags( $content, $images = array() ) { $sizes2crop = self::size_to_crop(); foreach ( $images[0] as $index => $tag ) { $width = $height = false; + $crop = null; $image_tag = $images['img_tag'][ $index ]; $is_slashed = strpos( $images['img_url'][ $index ], '\/' ) !== false; @@ -105,7 +106,7 @@ public function process_image_tags( $content, $images = array() ) { } if ( empty( $resize ) && isset( $sizes2crop[ $width . $height ] ) ) { $resize = $this->to_optml_crop( $sizes2crop[ $width . $height ] ); - } elseif ( isset( $crop ) ) { + } elseif ( $crop !== null ) { $resize = $this->to_optml_crop( $crop ); }