using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Admin_Ajax_AddPhoto : AjaxWindowBase
{
private string ParentScript = "";
protected override void OnInit(EventArgs e)
{
this.filePhotoUpload.FileUploaded += new EventHandler(filePhotoUpload_FileUploaded);
base.OnInit(e);
}
void filePhotoUpload_FileUploaded(object sender, EventArgs e)
{
if (chkThumbnail.Checked)
{
// resize the image to a thumbnail
string thumbAddress = "\\Resources\\Image\\thumb_" + filePhotoUpload.Filename;
string fullsizeAddress = "\\Resources\\Image\\"+ filePhotoUpload.Filename;
Graphix.GetSizedImage(Server.MapPath((Request.ApplicationPath.Length == 1 ? "" : Request.ApplicationPath) + fullsizeAddress), 125).Save(Server.MapPath((Request.ApplicationPath.Length == 1 ? "" : Request.ApplicationPath) + thumbAddress)); // use the default size of 125 pixels wide
ParentScript = "oEditor.InsertHtml(\"
\");";
}
else
{
ParentScript = "oEditor.InsertHtml(\"
\");";
}
filePhotoUpload.Filename = "";
}
protected override void Render(HtmlTextWriter writer)
{
if (ParentScript.Length > 0)
{
writer.Write("");
}
else
base.Render(writer);
}
}