From ffa4aa2d697c87eee44edc2f95f34b9a5ae899fc Mon Sep 17 00:00:00 2001 From: Timotei Date: Thu, 20 Jun 2024 14:39:58 +0300 Subject: [PATCH 1/2] Keep image attributes when replacing dimensions --- src/media.cls.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/media.cls.php b/src/media.cls.php index 3a5c7cd2f..bb01253cc 100644 --- a/src/media.cls.php +++ b/src/media.cls.php @@ -758,7 +758,7 @@ private function _parse_img() $attrs['width'] = $ori_width; $attrs['height'] = $ori_height; - $new_html = preg_replace('#\s+(width|height)=(["\'])[^\2]*\2#', '', $match[0]); + $new_html = preg_replace('#\s+(width|height)=(["\'])[^\2]*\2(["\'])#', '', $match[0]); $new_html = preg_replace('#content = str_replace($match[0], $new_html, $this->content); From 7d7c5e3369637016389660a5c248275c28700437 Mon Sep 17 00:00:00 2001 From: Timotei Date: Fri, 21 Jun 2024 05:17:37 +0300 Subject: [PATCH 2/2] Fix --- src/media.cls.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/media.cls.php b/src/media.cls.php index bb01253cc..297b21f9f 100644 --- a/src/media.cls.php +++ b/src/media.cls.php @@ -758,7 +758,7 @@ private function _parse_img() $attrs['width'] = $ori_width; $attrs['height'] = $ori_height; - $new_html = preg_replace('#\s+(width|height)=(["\'])[^\2]*\2(["\'])#', '', $match[0]); + $new_html = preg_replace('#\s+(width|height)=(["\'])[^\2]*?\2#', '', $match[0]); $new_html = preg_replace('#content = str_replace($match[0], $new_html, $this->content);