-
<%@ Page Language="C#" %>
-
<%@ Import Namespace="CuteWebUI" %>
-
<%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-
<script runat="server">
-
-
protected override void OnInit(EventArgs e)
-
{
-
base.OnInit(e);
-
-
string st=Request.QueryString["ShowThumbnail"];
-
if (st != null)
-
{
-
MvcUploader uploader = new MvcUploader(Context);
-
Guid guid = new Guid(st);
-
MvcUploadFile file = uploader.GetUploadedFile(guid);
-
if (file == null)
-
{
-
Response.StatusCode = 404;
-
Response.Write("Invalid File : "+guid);
-
Response.End();
-
}
-
using (System.Drawing.Image thumbnail = new System.Drawing.Bitmap(64, 64, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
-
{
-
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(thumbnail))
-
{
-
using (Stream stream = file.OpenStream())
-
{
-
using (System.Drawing.Image img = System.Drawing.Image.FromStream(stream))
-
{
-
g.DrawImage(img
-
, new System.Drawing.Rectangle(0, 0, thumbnail.Width, thumbnail.Width)
-
, new System.Drawing.Rectangle(0, 0, img.Width, img.Width)
-
, System.Drawing.GraphicsUnit.Pixel);
-
}
-
}
-
}
-
MemoryStream ms = new MemoryStream();
-
thumbnail.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
-
-
Response.ContentType = "image/png";
-
Response.Cache.SetExpires(DateTime.Now.AddYears(1));
-
Response.AddHeader("Content-Length",ms.Length.ToString());
-
Response.BinaryWrite(ms.ToArray());
-
Response.End();
-
}
-
}
-
}
-
-
</script>
-
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head id="Head1" runat="server">
-
<title>Untitled Page</title>
-
</head>
-
<body>
-
<form id="form1" runat="server">
-
<div>
-
<CuteWebUI:UploadAttachments runat="server" ID="UploadAttachment1">
-
<ItemTemplate>
-
<asp:Image runat=server ID=Image1 ImageUrl='<%# "Thumbnail.aspx?ShowThumbnail=" + Eval("FileGuid") %>' />
-
</ItemTemplate>
-
</CuteWebUI:UploadAttachments>
-
</div>
-
<div id='queuediv'>
-
</div>
-
</form>
-
-
<script type="text/javascript">
-
function CuteWebUI_AjaxUploader_OnQueueUI(list)
-
{
-
var container=document.getElementById("queuediv");
-
if(list.length<1)
-
{
-
container.style.display="none";
-
return false;
-
}
-
-
container.style.display="";
-
container.innerHTML="";
-
-
var table=document.createElement("table");
-
table.style.borderCollapse="collapse";
-
table.cellSpacing=0;
-
table.cellPadding=4;
-
table.border=1;
-
table.borderColor="darkgreen";
-
table.style.fontSize="9pt";
-
-
for(var i=0;i<list.length;i++)
-
{
-
var name=list[i].FileName
-
var size=list[i].FileSize
-
var stat=list[i].Status
-
var func=list[i].Cancel;
-
var row=table.insertRow(-1);
-
row.insertCell(-1).innerHTML=name;
-
var last=row.insertCell(-1);
-
if(stat=="Queue")
-
{
-
var btn=document.createElement("A");
-
btn.href="BLOCKED SCRIPTvoid(0)";
-
btn.onclick=func;
-
btn.innerHTML="cancel";
-
last.appendChild(btn);
-
}
-
else if(stat=="Finish")
-
{
-
last.innerHTML="<img src='Thumbnail.aspx?ShowThumbnail=" + list[i].FileGuid+"' />";
-
}
-
else
-
{
-
last.innerHTML=stat;
-
}
-
}
-
container.appendChild(table);
-
-
return false;
-
}
-
</script>
-
-
</body>
-
</html>