Is there a way to add a dynamic URL token to images so that the move from local host to live doesn't require code change?
When uploading images in content, the path changes form localhost to live, how can I have it consistent so the database can be exported without changes?
I would like to leave out the name of the site in the path
Handling of the links in the field having a WYSIWYG editor, or any other long text field is a common issue when the site moves from one server (say dev) to other (say stage or production).
The links should be saved in such a way that they do not break.
Pathologic module does that for you.
Pathologic is an input filter which can correct paths in links and images in your Drupal content in situations which would otherwise cause them to xe2x80x9cbreak;xe2x80x9d for example, if the URL of the site changes, or the content was moved to a different server. Pathologic can also solve the problem of missing images and broken links in your sitexe2x80x99s RSS feeds. See more example use cases on the documentation page.
AFAIK there's no such token. Even if it exists it will be hard to use: think in all places that the token should be used and token must be processed: inside content texts, link fields, even variables.
You should to use the same path for all enviroments.
If you really need different paths (for example, to hide a name) I suggest you to use a symlink in one of the environments: For example, if your local path is
/NAME/path and live path is
/NAME-TO-HIDE/path you can create a symlink that points from
/NAME-TO-HIDE/ in the live site. Nobody will see the NAME-TO-HIDE string but webserver will reach the right files thanks to the symlink.