From 4a909fcfcf5c7b0fafc58717186ca7a35d10c0f2 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 5 Apr 2018 06:01:36 +0000 Subject: [PATCH] Bugfix: The rendering with images with width and height was broken --- src/Content/Text/BBCode.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 40fb182fa1..7615ab08a8 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -242,6 +242,8 @@ class BBCode extends BaseObject // Simplify image codes $body = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $body); + $body = preg_replace("/\[img\=([$URLSearchString]*)\](.*?)\[\/img\]/ism", '[img]$1[/img]', $body); + $URLSearchString = "^\[\]"; if (preg_match_all("(\[url=([$URLSearchString]*)\]\s*\[img\]([$URLSearchString]*)\[\/img\]\s*\[\/url\])ism", $body, $pictures, PREG_SET_ORDER)) { if ((count($pictures) == 1) && !$has_title) { @@ -1718,6 +1720,9 @@ class BBCode extends BaseObject $text ); + $text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '', $text); + $text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '', $text); + $text = preg_replace_callback("/\[img\=([$URLSearchString]*)\](.*?)\[\/img\]/ism", function ($matches) { $matches[1] = proxy_url($matches[1]); @@ -1726,9 +1731,6 @@ class BBCode extends BaseObject }, $text); - $text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '', $text); - $text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '', $text); - // Images // [img]pathtoimage[/img] $text = preg_replace_callback( -- 2.39.5