From: Cyperghost Date: Wed, 10 Jan 2024 10:16:43 +0000 (+0100) Subject: Read image width only from `img` element X-Git-Tag: 6.0.7_dev_1~31 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=556db7dcf00247304b188f95c578cb138b901d8e;p=GitHub%2FWoltLab%2FWCF.git Read image width only from `img` element See https://github.com/WoltLab/editor/commit/deff5ef1cbac24c80a6d1d7fc230b2815391be47 --- diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php index 29b72642cf..a277060329 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php @@ -126,7 +126,7 @@ class HtmlInputNodeImg extends AbstractHtmlInputNode } } - $width = $replaceElement->getAttribute("data-width"); + $width = $element->getAttribute("data-width"); if (\preg_match('~(?\d+)px$~', $width, $matches)) { $width = (int)$matches['width']; } else { @@ -188,16 +188,6 @@ class HtmlInputNodeImg extends AbstractHtmlInputNode */ protected function mirrorWidthAttribute(\DOMElement $element): void { - // Aligned images are wrapped in a `
` element that is the target - // of the resize operation. - if ($element->nodeName !== 'img') { - $figure = $this->getParentFigure($element); - if ($figure !== null) { - $this->mirrorWidthAttribute($figure); - } - return; - } - $width = $element->getAttribute("data-width"); if ($width && \preg_match('~^\d+px$~', $width)) { $style = $element->getAttribute("style");