This is a migrated thread and some comments may be shown as answers.

Imagemanager Path issue

3 Answers 86 Views
Editor
This is a migrated thread and some comments may be shown as answers.
sachin
Top achievements
Rank 1
sachin asked on 13 May 2010, 09:23 AM
Hi,

For Imagemanager in Editor control, i have set path like

 

<ImageManager ViewPaths="~/images" UploadPaths="~/images" DeletePaths="~/images" SearchPatterns="*.jpg,*.gif,*.jpeg,*.png" MaxUploadFileSize="900000" />

 

 

But it shows like /[VirtualDirecotry]/images as a path for imagemanage, and after adding image it saves file like
<img src="/[VirtualDirecotry]/images/image.jpg"/>

So is there any way to display path like images instead of /[VirtualDirecotry]/images for imagemanage?
And store imagepath like only images/image.jpg, instead of ="/[VirtualDirecotry]/images/image.jpg"/

I want to get rid of virtual direcory name. Because i want to use same folder strucure for another project as well. So it will create problem, because virtual directory name is different, so path of image will not get for another site if i have to copy whole site to another site.

Is there any alternate way for my solution?

Thanks,
Sachin kotak

3 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 14 May 2010, 07:09 AM
Hi Sachin,

You can modify the default behavior of the ImageManager to match the required out by setting a callback function. Please check this forum thread for more details on the subject,

As an alternate solution you can override the ResolveDirectory method of the ImageManager's content provider to provide the required path, e.g.:
protected void Page_Load(object sender, EventArgs e)
{
    RadEditor1.ImageManager.ContentProviderTypeName = typeof(CustomFilebrowserContentProvider).AssemblyQualifiedName;
}
 
public class CustomFilebrowserContentProvider : FileSystemContentProvider
{
 
    public CustomFilebrowserContentProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)
        : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)
    { }
 
    public override DirectoryItem ResolveDirectory(string path)
    {
        DirectoryItem oldDirectory = base.ResolveDirectory(path);
         
         
        Page thisPage = this.Context.CurrentHandler as Page;
        //virtual path to the page
        string pageRoot = thisPage.TemplateSourceDirectory;
         
        List<FileItem> newFiles = new List<FileItem>();
        foreach (FileItem file in oldDirectory.Files)
        {
            FileItem modifiedFile = new FileItem(file.Name, file.Extension, file.Length, file.Location, file.Location.Replace(pageRoot, ".")/*file.Url*/, file.Tag, file.Permissions);
            newFiles.Add(modifiedFile);
        }
 
 
        DirectoryItem newDirItem = new DirectoryItem(oldDirectory.Name, oldDirectory.Location, oldDirectory.FullPath, oldDirectory.Tag, oldDirectory.Permissions, newFiles.ToArray(), oldDirectory.Directories);
 
        return newDirItem;
    }
 }

I hope this helps.

Kind regards,
Dobromir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
AMS
Top achievements
Rank 1
answered on 11 Feb 2011, 12:04 PM
Hi
Is this functionality available for 2009.2.701.20 of Telerik Controls? How can I check whether a particular functionality in my version is available or not?
Regards
0
Rumen
Telerik team
answered on 16 Feb 2011, 02:08 PM
Hello Abbid ,

The callback function provided in this forum thread as well as the FileSystemContentProvider are supported by v.2009.2.701.20 of RadEditor.
You can see the Release History page for more information.

Greetings,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
sachin
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
AMS
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or