It converts to backslashes because you are on a Windows system. The folder is used by php on your server. Your web log will display forward slashes.
Thread Starter
Joy
(@joyously)
I understand why, but I don’t agree that it should. When you output the gallery folder path on the settings page, it should be what I entered previously, not the converted path. Because when I hit Save, that bad path with backslashes replaces the good path with forward slashes that I entered before.
In Windows, the ‘good’ path has backslashes.
Thread Starter
Joy
(@joyously)
When you are in Windows, that’s is true, but when in WordPress, that is not true.
The plugin checks the gallery folder input field to see if the path is correct. If I enter backslashes in that text field, it is interpreted as escaped characters, so the path is invalid.
It shouldn’t be that difficult to save what is entered without any conversion.
You should try it, so you can see what I’m talking about.
I don’t see the escaped character issue running on WAMPSERVER.
I’m using a path like ..\wp-content\uploads\lg-gallery\
Thread Starter
Joy
(@joyously)
That path would work if it had forward slashes. Did you hit Save after it found the path? When you enter that path in exactly like that, it doesn’t find it because of the backslashes creating special characters in the input.
My folder is ../photos/ and it does not find it when it changes it to ..\photos
weird, I did hit save. something’s different on XAMPP vs WAMP I guess.
Any chance I could look on your server?
Please leave a topic on http://brimosoft.nl/forums/forum/how-to-and-troubleshooting/ so I could send you an email
Sorry, my bbpress plugin made a hickup. Your post did not get your e-mail or name.
Lazyest Gallery replaces slashes to be compatible with your server OS.
So on Windows, forward slashes get replaced by backslashes
This was necessary because of crashes on Windows servers.
I can’t reproduce your error on my machines. Even with obvious ‘escaped characters’ like \n in ..\..\wp-content\new-gallery\
the folder can be found.
Thread Starter
Joy
(@joyously)
I understand why you would change to backslashes, and that it might even be automatic in some function you call, but you don’t need to switch and you definitely don’t need to show the user something different than what was entered. The big problem comes when the converted path is saved because then it is invalid. It’s not when entered, it’s when it is saved again. In order to keep the settings working, the user has to go back to the path field and fix it, even though they only wanted to change some of the other settings (not the path).
It sounds like you didn’t test the scenario all the way through:
0. plugin prompts for gallery folder path only
1. user sets the gallery folder path and saves
1a. plugin finds it and shows the settings fields (including a modified path)
2. user changes sizes etc. and saves (path is saved with backslashes)
2a. plugin still finds path and shows settings
3. user changes another setting and saves (without changing path)
3a. plugin now can’t find path and doesn’t show settings
The critical point is to redisplay what the user typed originally, not the modified version.
I don’t see a reason to save the user input also. I’d rather fix this bug.
Thread Starter
Joy
(@joyously)
Plugins that convert to backslashes and redisplay always have the problem of the increasing backslashes, because to enter one you have to type two, so each time it is converted and redisplayed it grows.
hm, wish I could repeat that, backslashes save and resave normal in Lazyest Gallery settings. I’m still searching why it wouldn’t work on your XAMPP server.
FWIW, I’m on a WAMP localhost server and never use backslashes in path names for any PHP app. Neither Apache nor PHP ever seem to have an issue locating files with forward slashes in a path name on my Windows box. It is possible IIS might have issues with forward slashes, though it follows that many open source products would fail to run on IIS if that were true, including WP. WP only uses forward slashes in paths, such as all its include statements.
I think it should be pretty safe to abandon the back slashes.
true,
lazyest-gallery 2.0 will abandon backslashes