Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Which classes rewrite the image paths in HTMLText

Go to End

4 Posts   944 Views


Community Member, 135 Posts

17 February 2012 at 10:00am

Edited: 17/02/2012 4:32pm

Guys, PLEASE PLEASE HELP!! I'm old(ish), you can see that from my boater!

I am desperate to fix a jquery mobile issue.

I have posted a couple of times but with no replies. I have since found the problem but I can't find which classes I have to modify. The are very deep in the CMS.

What I want is to alter the image insert pane so it alters images to have a leading slash. I then want to alter the save parser and image resizer so that it doesn't remove a slash that is there when it creates a new filename/path.

Here goes ...I have partly found the answer to the strange rewrites of /assets/image.jpg to assets/image.jpg. In this following real world example the leading slash gets stripped by the class that creates a new image size:



I'm not asking for a fix - I can do that but I cant find where.



Community Member, 135 Posts

17 February 2012 at 1:55pm

I might add that this was posted to the net, thus showing how annoying this behaviour is. This is a classic case of shutting the door after the horse has bolted:


Forum Moderator, 1391 Posts

18 February 2012 at 1:50am

I suppose you are referring to images inserted into the TinyMCE editor, using the SilverStripe sidepanel? This isn't easy to find. It's handled by the javascript file sapphire/javascript/tiny_mce_improvements.js.

Somewhere around line 624, in the insert() function it says:

var baseURL = document.getElementsByTagName('base')[0].href;
var relativeHref = this.href.substr(baseURL.length);

Thus subtracting the contents of the <base> tag from the href. I suppose you could experiment wth adding a '/' to the front of the relativeHref, if it doesn't start with, say, 'htt'...

Mind: experiment! I haven't the faintest idea what kind of problems shutting the door in front of this bolting horse might get you into, in this case :-)


Community Member, 135 Posts

22 February 2012 at 12:25pm

In the end I gave up and applied the fix I mentioned since although nuts, it was simple and will survive updates! I still think there should be an option to use root relative urls though (and jquerymobile) falls to bits without them. The fix is now in use at

However thanks for telling me where to look. I still need to find where the image resizer does its work in stripping the leading slash too.