Hi,
I've been using CK Finder a while now and just realised that it doesnt automatically rename directories to remove spaces ... example - I can create a directory called 'flemmings images' .. which is fine and generally works - but I think there may be some circumstances where this is a problem? If not a problem it certainly (to me) looks a little unprofessional, to see '%20' in image paths!
I know I can put an underscore in myself rather than a space .. but the system I'm creating is for a bunch of teachers and I KNOW that despite my best efforts to train them they will forget of ignore my advice!
If there was some easy way to auto replace spaces in directory names I would LOVE to hear about it!
many thanks!
Flemming
I've been using CK Finder a while now and just realised that it doesnt automatically rename directories to remove spaces ... example - I can create a directory called 'flemmings images' .. which is fine and generally works - but I think there may be some circumstances where this is a problem? If not a problem it certainly (to me) looks a little unprofessional, to see '%20' in image paths!
I know I can put an underscore in myself rather than a space .. but the system I'm creating is for a bunch of teachers and I KNOW that despite my best efforts to train them they will forget of ignore my advice!
If there was some easy way to auto replace spaces in directory names I would LOVE to hear about it!
many thanks!
Flemming
Re: Auto rename directory to remove spaces (replace with undersc
Re: Auto rename directory to remove spaces (replace with undersc
All you need to do is to change a bit code of the server connector, which is located in the "core\connector" directory ("_source" in CKFinder for ASP.NET).
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Auto rename directory to remove spaces (replace with undersc
Re: Auto rename directory to remove spaces (replace with undersc
If you're using PHP this is how you can auto rename directories (to stop users putting spaces in the directory name for example) ...
In: ckfinder > core > connector > php > php4 (or 5) > CommandHandler > CreateFolder.php look for :
and add in these 3 rows in between
so it looks like this :
and that's all there is to it! you can of course add whatever you need into the array that I've called 'replacers' - $replacers = array("foo", "bar", "helloworld"); and these will all be replaced with whatever character you specify in the str_replace.
Re: SOLVED :::::::::::: Auto rename directory to remove spaces (
I've also done something similar in .NET.
I added a simple replace function into the existing Util class to replace any non-url friendly characters (spaces and the like) To implement, modify the Util class in \Connector\Util.cs and add the following function (at the end will be fine)
Re: SOLVED :::::::::::: Auto rename directory to remove spaces (
nifty little hack
This should be made standard in CKFinder
Now on to figuring out how to stop my clients from uploading images with spaces or weird characters...
wOOt
WebDude
Re: SOLVED :::::::::::: Auto rename directory to remove spaces (
The same approach for directories can be used for filenames, just find where the filename is created in the appropriate handler. For example
\Connector\CommandHandlers\FileUploadCommandHandler.cs
after line 45:
\Connector\CommandHandlers\RenameFileCommandHandler.cs
after line 35:
Note: THIS IS UNTESTED - I've just found the relevent lines, there may be something I've missed, but its pretty simple stuff, anybody who's been using .net for more than 5 minutes should be able to understand it.
Re: SOLVED :::::::::::: Auto rename directory to remove spac
Could anyone tell me how I do this for uploaded images?
At the moment the spaces are replaced by "%20" and it'd like it be an underscore.
The files do get uploaded correctly at the moment, but the URL wont work.
Whatever change I make in the sourcecode it never works in my project ... I rebuild and re-add the folder to my project ... nothing. What am I doing wrong?
Thanks in advance,
- Yannick
Re: SOLVED :::::::::::: Auto rename directory to remove spac
Yannick,
In the following file:
Go to line 58 and you will find this:
Change it to this:
This will replace the spaces for an underscore and, like in my custom CMS, will stop throwing errors on PHP commands such as getfilesize() and similar.
Hope this helps you mate,
George.
Re: SOLVED :::::::::::: Auto rename directory to remove spac
Re: SOLVED :::::::::::: Auto rename directory to remove spac
Attachments:
Re: SOLVED :::::::::::: Auto rename directory to remove spac
Ideas?
Thanks,
Shai Gluskin
Re: SOLVED :::::::::::: Auto rename directory to remove spac
Line 331:
Robert Mikołajuk
PHP Developer, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+