Converting relative path to absolute path

      No Comments on Converting relative path to absolute path

Currently working on a project that needs to export views to MS word file. View contains several nodes with images. I am using views export data module to export the views to doc file. Everything was fine but when I was exporting views, images are not showing in document file. I checked the HTML and found that img src is using relative path (e.g: /project/sites/files/image1.jpg). So I had to find a way so that relative paths convert automatically when HTML page generates.

Solution was pretty simple, set base href in HTML head section. like this:

<base href=”http://localhost/”/>

And job done!

Leave a Reply

Your email address will not be published. Required fields are marked *