File Explorer Thumbnails view - Custom file browser

2 posts, 0 answers
  1. hp
    hp avatar
    2 posts
    Member since:
    Apr 2014

    Posted 04 Apr 2014 Link to this post

    Hi

    I have implemented the custom file browser as specified in the online resources. I am using shared paths like "\\172.0.0.0\images".

    Everything else seem to work except for thumnails view.

    I also tried cssclass - rfethumbnails but it doesn't help.

    I have implemented all 4 methods that determine thumbnails for the images.

    public override string GetFileName(string url)
            {
                string fileName = Path.GetFileName(RemoveProtocolNameAndServerName(url));
                return fileName;
            }
            public override string GetPath(string path)
            {

                // First add the '~/' signs in order to use the VirtualPathUtility.GetDirectory() method ;
                string PathWithTilde = "~/" + path;
                string virtualPath = VirtualPathUtility.GetDirectory(PathWithTilde);
                virtualPath = virtualPath.Remove(0, 2);// remove the '~' signs
                return virtualPath;            
            }
            /// <summary>
            /// Verify the file selected
            /// </summary>
            /// <param name="url"></param>
            /// <returns></returns>
            
            public override Stream GetFile(string url)
            {
                string virtualPath = RemoveProtocolNameAndServerName(url);
                string physicalPath = this.GetPhysicalFromVirtualPath(virtualPath);
                if (physicalPath == null)
                    return null;

                if (!File.Exists(physicalPath))
                {
                    return null;
                }

                return File.OpenRead(physicalPath);
            }
            public override string StoreBitmap(System.Drawing.Bitmap bitmap, string url, System.Drawing.Imaging.ImageFormat format)
            {
                string virtualPath = RemoveProtocolNameAndServerName(url);
                string physicalPath = this.GetPhysicalFromVirtualPath(virtualPath);
                if (physicalPath == null)
                    return string.Empty;

                StreamWriter bitmapWriter = StreamWriter.Null;

                try
                {
                    bitmapWriter = new StreamWriter(physicalPath);
                    bitmap.Save(bitmapWriter.BaseStream, format);
                }
                catch (IOException)
                {
                    string errMessage = "The image cannot be stored!";
                    return errMessage;
                }
                finally
                {
                    bitmapWriter.Close();
                }
                return string.Empty;
            }

  2. Vessy
    Admin
    Vessy avatar
    1380 posts

    Posted 09 Apr 2014 Link to this post

    Hello,

    I am not quite sure whether I understand the exact issue properly. In case you would like to implement a custom thumbnails functionality, you should use an approach similar to the one described in this forum thread: Custom Thumbnails

    If this is not the case, though, would you explain what is the exact scenario you want to achieve?

    Regards,
    Vessy
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top