(2023-08-15, 07:22 PM)Devilshakerz Wrote: [ -> ]Looks like there are some missing quotes in the Replacement HTML.
Try:
<a href="$1"><img src="$2" class="post_image" title="Click to view image" /></a>
Thanks
Devilshakerz, this worked.
But, not without a "divine inspiration".
After I update the content of
"Replacement" text with the one you sent me - and save it - I refreshed that forum page and nothing happened.
Then, I entered in edit mode of my_code again and for my surprise the contente was still the old one. I changed the
"Regular Expression" and after save it I checked it back and it was OK (kept the changes).
So, the way to get the proper replacement saved was to create a new one. Now the page is showing
almost all images correctly.
There is an image that has an extra parameter
[img size=15x150 link=https://i.imgur.com/1zdae1p.png]https://i.imgur.com/1zdae1p.png[/img]
It seems the previous code was not working too, so I changed it to:
Replacement:
\[img size=(.*?)x(.*?) link=(.*?)\](.*?)\[/img\]
Regular Expression:
<a href="$3"><img src="$4" class="post_image" width="$1" height="$2" title="Click to view image" /></a>
HTML Result:
[img size=150x150 link=https://i.imgur.com/1zdae1p.png]https://i.imgur.com/1zdae1p.png[/img]
The only think I see different is the fact that we are using the latest parameters first. Do they need to be in order?
The previous was only:
\[img size=(.*?)x(.*?)\](.*?)\[/img\]
and its order of execution was 2.
Quote:Replacement:
\[img size=(.*?)x(.*?) link=(.*?)\](.*?)\[/img\]
Regular Expression:
<a href="$3"><img src="$4" class="post_image" width="$1" height="$2" title="Click to view image" /></a>
HTML Result:
[img size=150x150 link=https://i.imgur.com/1zdae1p.png]https://i.imgur.com/1zdae1p.png[/img]
I fixed this one by removing and creating it again.
Definably something is strange after the update - hard to know what or where.
There is only one image (
here) in that forum page that is not getting formatted and it's a simple [img] tag - which should result in the image be downsized to 600px max (
<a href="$1"><img src="$1" style="max-width:600px; max-height:600px;" title="Click to view image"></img></a>), but it's still big (which works fine when editing and using
"Test MyCode" buttom).
By checking the page source I noticed that image has a class assigned to it named:
"mycode_img".
I found that it may be result of a fail in evaluate the template in
./inc/class_parser.php:
...
eval("\$mycode_img = \"".$templates->get("mycode_img", 1, 0)."\";");
return $mycode_img;
The strange thing is that other images were processed correctly.
Let's keep digging.