Some myImageBrowse.aspx details
Q:
I have to implement a scenario where I need to browse Image files available via UNC path on a different machine, than the editor itself is running.
I do not understand the example given in myImageBrowse.aspx file. I do not need any advanced features like generating thumbnails or such, I only need to be able to browse specific folder using
System.IO.DirectoryInfo myDirectoryInfo = new System.IO.DirectoryInfo("\\some_unc_path\somedirectory\");
if (myDirectoryInfo.Exists)
{
foreach (System.IO.FileInfo fi in myDirectoryInfo.GetFiles())
{
// Implementation goes here
}
}
and then return the file name into ImageBrowse dialog window.
A:
You can render the Image browse window content as you want (use tree or something else).
The main thing is to notify the parent window what file was selected before "OK" button is clicked..
You can find this JavaScript code in myImageBrowse.aspx file:
//
// Important. Change the Image URL in parent window.
//--------------------------------------------------------
try
{
parent.document.getElementById("selectedSrc").value=src;
parent.document.getElementById("selectedWidth").value=mWidth;
parent.document.getElementById("selectedHeight").value=mHeight;
parent.document.getElementById("selectedAltText").value=title;
}
catch(e){}
//--------------------------------------------------------
The parent window has hidden input fields with the following id's:
selectedSrc - file name of selected image with full path or not, it can be something like
http://some_unc_path/somedirectory/my_Get_Image.aspx?id=123456 .
selectedWidth - width of the image in pixels.
selectedHeight - height of the image in pixels.
selectedAltText - comment for the image, it can be empty.
|