Jump to content

Image URLs


Pete
 Share

Recommended Posts

Hi chaps

I was just having a look at importing some content from another site (excellent examples of how to import images on the forums here as well!), and I noticed that in the PW database itself when an image is inserted into the body there's an alarming path involved.

For example:

<p><a href="/pw/site/assets/files/5812/sailing.jpg"><img src="/pw/site/assets/files/5812/sailing.212x0.jpg" width="212" height="141" /></a></p>

On my localhost test server the site is in a /pw/ directory, but if I pushed this live then the image links would be incorrect (they would obviously just need to be /site/assets/...).

Does PW somehow take this into account when a site goes live and the folder structure changes? On other CMS systems I've used it would just be a relative URL as well, so no / at the beginning and rely on the user to set the base_href in the head area of the HTML template which is a bit more reliable if you're testing at one address, maybe having to test on an intermediate server as well with a different URL (unlikely in most cases but it can happen depending on the client) and then finally going live on the actual final domain.

Link to comment
Share on other sites

If your dev environment is running in a different path than your web site, then you are right this will be a problem. It's the case for me, as I have everything running off of paths on my dev server, but the web sites ultimately run off the web root.

This module solves that problem for everything from asset links to page links and even moved pages:

http://processwire.com/talk/index.php/topic,280.0.html

90% of the time, this is probably going to be a TinyMCE specific issue, so I should probably just build some basic root URL abstraction right in the TinyMCE module...

Link to comment
Share on other sites

90% of the time, this is probably going to be a TinyMCE specific issue, so I should probably just build some basic root URL abstraction right in the TinyMCE module...

Love the module - soemthing similar exists in MODx where page links (in the old version) are written as [~7~] and translated on the fly (possibly the cached version has them converted to real URL's - can't remember).

I think the TinyMCE alteration would be the way to go if at all possible as it's then a built-in solution. For now though it wouldn't be rocket science for me to do a search and replace in the database to simply strip out any mentions of /pw/ in the fields, just thought it was worth mentioning.

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...