0

I've begun bending Habari to my will, and just noticed that the javascript-driven image insert feature returns the absolute path by calling fileobj.url when building the HTML.

This is a bit of a problem when one wants to be able to run a blog mirror on a testbed, since my testbed image inserts are all sourced to d:\websites\habari\...

Is there an easy way to get fileobj to cough out a relative path rather than absolute?

(found all sorts of questions about relative --> absolute, but none the other way!)

1 Answer 1

1

You should be able to add Javascript to override habari.media.output. See the wiki page on Adding Javascript and CSS, as well as the editor plugins, for example jwysiwyg, which do something similar. Then you should be able to remove the domain and path to Habari with a call to Site::url('habari') and some string munging.

Sign up to request clarification or add additional context in comments.

3 Comments

Hi Michael. I recognize your name from the Dev Group. I assumed this was a JS-specific problem, rather than an issue with Habari, which is why I posted it here as I didn't want to clog up the Dev Group with non-Habari specific issues. :-)
No worries, I'll try to answer questions anywhere I can :)
You could (using jQuery, since it's already loaded in the admin) intercept the form submission on the publish page and rewrite links in the content textarea. The url you want to remove is already on the page too as habari.url.habari. Something like $('#create-content').submit(function() {var text=$('#content');text.val(text.val().replace('foo','bar'));}); with an appropriate regex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.