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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Strange relative image Mobile Behaviour


Go to End


2 Posts   790 Views

Avatar
tazzydemon

Community Member, 135 Posts

16 February 2012 at 9:44am

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 https://github.com/fonsekaean/silverstripe-mobile) 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 http://mydomain.com/home) 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.

Julian

Avatar
tazzydemon

Community Member, 135 Posts

16 February 2012 at 3:59pm

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:

from
/assets/images/oldfavourites/Derek-2LR.jp

to
assets/images/oldfavourites/_resampled/resizedimage250333-Derek-2LR.jp

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.

Julian