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.

All other Modules

Discuss all other Modules here.

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

Strange relative image Mobile Behaviour


2 Posts   381 Views


16 February 2012 at 9:44am Community Member, 122 Posts

Sorry about cross posting this but it was mighty unclear where I should as the principal question seems to be a data manipulation one.

I have a weird one here. I have modified and extended the silverstripe-mobile module (using this fork and am using a new version of jquerymobile.

It all works fine save for one thing. The pages are ajax loaded and thus the base href is the calculated as the first page (say This makes many subsequent images fail given that they start "assets" and not "/assets"

That's when the wierdness starts. In the following example:

<p><img class="left" src="assets/images/abouttheshow/_resampled/resizedimage350233-Fish1a.jpg" alt="show" width="350" height="233" />A show for the whole family.</p>
<p class="clearboth">&nbsp;</p>
<p><img class="right" src="/assets/images/abouttheshow/_resampled/resizedimage400266-Kids8a.jpg" alt="Kids" width="300" /></p>

If I change the first image to "/assets" and save, it changes back and yet that does not happen to the image with the right class. Huh? This is clearly being manipulated by SS prior to saving but where? I can't find it.

Furthermore how can I force the system or TinyMCE to use root relative urls. TinyMCE is surprisingly vague on this as their idea of relative and absolute urls is a bit different. I want root relative urls.



16 February 2012 at 3:59pm Community Member, 122 Posts

Eureka, sort of.

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



I had missed that originally.

So there remain 2 small issues...

1. How do I insert images in the editor with the leading slash without having to do them manually - i.e which config or class do I have to modify.
2. I am sure that the class responsible for the resizing should not be stripping the leading slash off. Its should leave the url in whatever state it was.