Jump to content

CKEditor: Absolute image path possible?


doolak
 Share

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...