tinyZenage paths to image

Is it possible to setup tinyZenpage or tiny_mce with a base path that will be agnostic to moving from one server to another?

I have been using the editor and tinyZenpage to add sized images to my articles and everything works great. But when I migrate my work from my local server to the remote one by backing up the local then using that to restore the remote the link to the full image is wrong.

On the local side I have a folder with the domain name at the root and on the remote zenphoto is installed at the root. So the links all have the extra folder name added to them such as:
/domain_name_folder/album_name/image_name.php

It of course works great until I move to the remote server and the final link ends up being:
http://domain_name/domain_name_folder/album_name/image_name.php

I read through the info here and on the tiny mce wiki to see if I could change this but either I am overlooking something or it cannot be done.

For now the only way I can get things to work on the remote server and survive further updates from the local is to manually change the link from the thumb to the full image deleting the first part with the domain name folder. I can't use the image for a link locally but I can live with that.

I just curious if there is a better way.

Thanks

Comments

  • acrylian Administrator, Developer
    Not conveniently. Since TinyMCE is a text editor with static content the images you embed have different paths on the backend and on the site itself. You would loose the display in the backend if we would not use absolute paths (or other way round).
  • That what it looked like after poking around and reading but I just wanted to be sure I wasn't missing something.

    Thanks acrylian, I'll just keep doing what I am doing. It only takes a moment to 'fix' them for the remote location.

    I appreciate the info. :)
  • Could you change your settings on your local server?

    If you are using XAMPP, it is possible to configure the file httpd-vhosts.conf which sits into the x:\xampp\apache\conf\extra folder, so you may have more than one local domains, such as domain1.localhost, domain2.localhost, etc.

    You then need to either update your "hosts" file (on Windows) or configure a proxy so that "domain1.localhost" stays locally. I use the latter approach with both XAMPP Portable and Firefox Portable with the FoxyProxy Standard extension configured so that "*.localhost" is sent to 127.0.0.1 and everything else is sent to the web. With that, all three websites I currently support are at root level both locally and on the web.
  • Thank you Michel, I can change server settings locally and do use XAMPP. It is for the setup on my laptop used for local development. I will give this a good read once the morning coffee kicks in. :)
    It does seem to be exactly what I am after. The info is much appreciated.
  • @acrylian
    Actually you don't really lose anything by borking the link manually. I think perhaps I misunderstand what you mean. I was manually deleting the extra folder from the head of the link in the editor and only lost the ability to follow the link to the full image locally. The article still had the generated thumbs in place.
    EDIT: I stand corrected. I must have been looking at a cached version. Your statement as posted was exactly right.

    @Michel, works like a dream. Thanks for the tips.

    One thing to add though, and it was just a silly thing to overlook on my part. Once you make the changes of adding the new virtual host info in xampp and add the new lines to the hosts file you will need to rerun setup unless you like looking at error500. ;)

    Works great. No more tweaking the links as I write new articles and I can test identically on both servers.
  • acrylian Administrator, Developer
    The actual link of the sized images depends on their status when you embed them via tinyZenpage. All images go first through the image processor on /zp-core/i.php and then are cached within /cache/<album>. So if the image is already cached in that size embedded it links to the cache, otherwise to the processor.

    It would surly be possible to code something to use a kind of placeholder that is replaced dynamically. But it would have to be different on TinyMCE and on the frontend I guess so I am not sure if the work is justified.
  • :) exactly
    It took me a bit to realize where the image placeholder was coming from until I noticed the first time I looked at the link in tinyMCE it had the one pointing at i.php. Afterward it had the link with the album name.

    The method of specifying multiple localhost roots is actually a better solution. No needed trickery is just keeps the local and remote roots in alignment no matter where you have them.

    I was focusing too hard on the tree to notice the forest so to speak. I would second that the work would not be justified when there are always plenty of other things to keep you busy... ;)
Sign In or Register to comment.