[img] shortcode embeds URL encoding?
-
Hi, I was wondering if anyone has seen this problem regarding URLs generated by the [img] shortcode.
For example, if this image is put in like this:
[img]https://example.com/wp-content/uploads/album/254/BW-Kal-600x600.png[/img]
The browser (at least Firefox) returns a 404 Not Found on the URL that is generated. What’s funny is that if you look at the Page Source, it looks like this:
<img class="d4pbbc-image" src="https://example.com/wp-content/uploads/album/254/BW-Kal-600x600.png.png">
which is fine! But, if you go to the Network tab of Firefox’s Inspect Element window, then click on the 404 line for that image, then click on the “Edit and Resend” button, the actual URL is this:
https://example.com/wp-content/uploads/album/254/BW-Kal-600%C3%97600.png
Very strange! If I manually edit the HTML to replace
%C3%97
withx
(like it is supposed to be), then the page will load the image.I found code in the
bbcodes.php
file in lines 487-502 like this:public function shortcode_img($atts, $content = null) { if (is_null($content)) return ''; if (!$this->_scope()) return $content; $atts = $this->_atts('img', $atts); $args = isset($this->shortcodes['img']['args']) ? $this->shortcodes['img']['args'] : array(); $args['src'] = $content; if ($atts['img'] != '') { $parts = explode("x", $atts['img'], 2); if (count($parts) == 2) { $args['width'] = intval($parts[0]); $args['height'] = intval($parts[1]); } }
So that is at least one place where it is trying to find an
x
so it can generate thewidth
andheight
attributes.I can’t figure out where else the URL for the image
src=
is generated.Any ideas?
- The topic ‘[img] shortcode embeds URL encoding?’ is closed to new replies.