doolak Posted September 15, 2015 Share Posted September 15, 2015 In an actual project I had to install PW in a subdomain and display the content via JSON / Pages Web Service. So I have the problem that, when adding images to a CKEditor textarea, the image path has to be absolute. Is there a possibility to make CKEditor render the image path in that way? Link to comment Share on other sites More sharing options...
doolak Posted September 15, 2015 Author Share Posted September 15, 2015 As I found no solution without hacking the core I tried to do it with jQuery. This seemed to work, but then I recognized that the browser will have already tried to load the images from the relative path before the script will be called. So I am using a PHP solution now: $body_orig = $page->body; $body_absolutepath = str_replace("/site/assets/files/", "http://xyz.de/site/assets/files/", $body_orig); echo $body_abosultepath; This works fine - but if somebody knows a simpler and better solution, please let me know. Link to comment Share on other sites More sharing options...
bernhard Posted September 16, 2015 Share Posted September 16, 2015 Only thing that comes to my mind is that you could create a text formatter for that. It would do quite the same as your php example but you could easily append it to any textarea field you want and make changes at a single location Link to comment Share on other sites More sharing options...
Juergen Posted September 16, 2015 Share Posted September 16, 2015 PHP string replacement is what I would do. I dont think that you really need an extra module for such a simple thing. I always try to avoid JS for output manipulation because its not cacheable and depends on that JS is activated by the user. So your solution seems to me as the best way for this purpose. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now