close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Choose Image - Slashes are incorrect in path

Thread began 6/22/2011 1:28 pm by codamedia | Last modified 11/25/2011 1:49 pm by neo314 | 5831 views | 21 replies |

codamedia

Choose Image - Slashes are incorrect in path

This is happening with KFM whenever I use KFM to create sub-folders.

If I insert an image that is deeper in a path, I get both forward and reverse slashes, and the image link becomes broken until I fix them.

EG:
/resources/pages/media/head_2.jpg (< this is correct)
/resources/pages/media\test\2/head_2.jpg (< you can see what this is doing)

This happens whenever I use a folder created with KFM. If the structure is already in place on the server (/resources/pages/media) then it is fine.

Any suggestions? A setting in KFM maybe?

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

neo314

I saw the same thing on a windows machine. I am currently assuming when I upload to a unix host, that won't happen, but it should be consistent.

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

neo314

Well I figured out a few things. I was seeing a missing slash between the userfiles directory and the first sub-directory. The source file has a user files path of ../../files, and I still have a problem that the site definition for the site would not let me browse for a directory, so I entered it in the same fashion as the files listing, /assets (notice I had to insert a leading forward slash or end up with /assets/assets). The correct listing should be /assets/. That causes the slash to be included between assets and events in my example above. See Troubleshooting

The problem with the wrong slashes occurs when there is more than one sub-directory of depth below the user files. It is appending the directory path to the user files directory, adding a / and then the file name. Therefore, one sub-directory is fine (/assets/events/file.jpg), but two or more sub-directories deep is not (/assets/events\event\sponsors/file.jpg.

Editing the file /webassist/kfm/plugins/return_url/plugin.js can patch the issue. I don't think it is the best fix because KFM is still reporting the bad slashes in the file properties, so it doesn't get to the root of the issue, but it does resolve the issue for CKEditor.

Lines 3 & 4 need to add url=url.replace(/\\/g,'/'); so it reads like this:

x_kfm_getFileUrls(selectedFiles,function(urls){var caption='',url='';if(files.length==1&&File_getInstance(files[0]).width){url=urls[0].replace(/([^:]\/)\//g,'$1');url=url.replace(/^\/\//,'');url=url.replace(/\\/g,'/');caption=File_getInstance(files[0]).caption;}
else{if(files.length==1)url=urls[0].replace(/\\/g,'/');else url='"'+urls.join('","')+'"';}



That fixes the urls being fed to CKEditor. It might be necessary to add a similar replace for the last else condition, but I could not figure out what that statement is for. This works for images and links.

Sign in to reply to this post

codamedia

NEO314: I never came back to this thread because Ray had set me up with a hack that was getting the job done. BUT - your solutions is much better, and only requires the one page to be edited (the .js file mentioned).

I just tested it and it works great. Thanks for posting this.

Sign in to reply to this post

neo314

I'm glad it helped. I would sure like to know what that last else condition is for...

Sign in to reply to this post

randyrie405335

Image Path Incorrect

I've add " $kfm_userfiles_output = rel2abs($kfm_userfiles_address,dirname(__FILE__)). "/"; " to line 27 in the configuration.php file to resolve a missing slash in the image path (per a solution provided by one of your tech reps).

Works fine in three of my websites, however, now in my latest web, I get: "D:/Hosting/5230337/html/FileUploads/Images/gift_giving.jpg" in the image path. If I manually remove everything to the left of "/FileUplods/..." the image displays. How do I correct so the path does not add the "D:/Hosting/5230337/html" to the path?

Sign in to reply to this post

neo314

You need to remove document root from __FILE__. It should be something like:

rel2abs(str_replace($_SERVER['DOCUMENT_ROOT'],"",$kfm_userfiles_address,dirname(__FILE__))). "/"; "
Sign in to reply to this post

randyrie405335

Remove Document Root...

I've modified the line to:
$kfm_userfiles_output = rel2abs(str_replace($_SERVER['DOCUMENT_ROOT'],"",$kfm_userfiles_address,dirname(__FILE__))). "/";

but now the server host reports this error:

Warning: Missing argument 2 for rel2abs(), called in D:\Hosting\5230337\html\webassist\kfm\configuration.php on line 29 and defined in D:\Hosting\5230337\html\webassist\kfm\library.php on line 71

Am I missing something in the syntax? (I am not a programmer)

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...