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;
}
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;
}