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

File Explorer Thumbnails view - Custom file browser

1 Answer 95 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
hp
Top achievements
Rank 1
hp asked on 04 Apr 2014, 02:30 PM
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;
        }

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 09 Apr 2014, 11:13 AM
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.

 
Tags
FileExplorer
Asked by
hp
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or