3066 Posts in 866 Topics by 648 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 302 Views |
-
Which classes rewrite the image paths in HTMLText

17 February 2012 at 10:00am Last edited: 17 February 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:
from
/assets/images/oldfavourites/Derek-2LR.jpgto
assets/images/oldfavourites/_resampled/resizedimage250333-Derek-2LR.jpgI'm not asking for a fix - I can do that but I cant find where.
Julian
-
Re: Which classes rewrite the image paths in HTMLText

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:
http://www.electrictoolbox.com/silverstripe-prefix-img-src-assets-leading-slash/
-
Re: Which classes rewrite the image paths in HTMLText

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
-
Re: Which classes rewrite the image paths in HTMLText

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 http://boatshow.co.nz
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.
| 302 Views | ||
|
Page:
1
|
Go to Top |
