private bool UpLoadImageFile(FileInfo info) { try { /// /// striming image /// byte[] byteContent = new byte[info.Length]; FileStream objFileStream = info.OpenRead(); objFileStream.Read(byteContent, 0, byteContent.Length); objFileStream.Close(); /// /// Processing image /// byteContent = EditImage.GetThumbNail(byteContent, 124, 90, true); byteContent = EditImage.SetWatermark(byteContent, WebConfig.GetValues("FName"), 50, true, 36); /// /// DataBase operation starts /// HF_SSID.Value = getSucessID(); //DateTime dateTemp = DateTime.Parse(DDL_dobMonth.SelectedIndex.ToString() + "/" + DDL_dobDay.SelectedValue + "/" + DDL_dobYear.SelectedValue); return(MatrimonialSuccessStoryManager.AddSuccessStory(HF_SSID.Value, TB_SucessStory.Text, L_MatID.Text, TB_Bride.Text, TB_Groom.Text, DateTime.Parse(DDL_dobMonth.SelectedIndex.ToString() + "/" + DDL_dobDay.SelectedValue + "/" + DDL_dobYear.SelectedValue), byteContent)); } catch (Exception ex) { return(false); } }
private bool UpLoadImageFile() { /// striming image try { byte[] byteContent = File_Upload.FileBytes; //Insert Image into session Session.Add("ImageToCrop", EditImage.GetThumbNail(byteContent, 600, 600, true)); byteContent = null; //retruning Values return(true); } catch (Exception) { return(false); } }
protected void IB_Crop_Click(object sender, ImageClickEventArgs e) { try { ///GetImage byte[] byteArray = (byte[])Session["ImageToCrop"]; // Removing image from session Session.Remove("ImageToCrop"); /// Get Application String HttpCookieCollection objHttpCookieCollection = Request.Cookies; HttpCookie objHttpCookie = objHttpCookieCollection.Get("MatRegInfo"); string strApplicationID = Crypto.DeCrypto(objHttpCookie.Values["ApplicationID"]); /// crop image byteArray = EditImage.CropImageFile(byteArray, Convert.ToInt32(HiddenW.Value), Convert.ToInt32(HiddenH.Value), Convert.ToInt32(HiddenX.Value), Convert.ToInt32(HiddenY.Value)); /// make thumbnail byteArray = EditImage.GetThumbNail(byteArray, 128, 128, false); /// water mark image byteArray = EditImage.SetWatermark(byteArray, WebConfig.GetValues("FName"), 80, true, 16); /// upload into database if (MatrimonialAlbumManager.InsertPhoto(strApplicationID, byteArray, MatrimonialAlbumManager.ImageType.Photo)) { Response.Redirect("../Extras/Sucess.aspx"); } else { Response.Redirect("image.aspx?id=Error"); } } catch (Exception) { } }
protected void Page_Load(object sender, EventArgs e) { if ((Request.QueryString["matid"] == null) || (Request.QueryString["id"] == null)) { Server.Transfer("../extras/ErrorReport.aspx"); } else { string strApplicationID; //get image byte[] byteImageArray = null; switch (Request.QueryString["id"]) { case "1": // member photo strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]); if (strApplicationID != null) { byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Photo); } break; case "2": //Album1 strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]); if (strApplicationID != null) { byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Album1); } break; case "3": //Album2 strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]); if (strApplicationID != null) { byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Album2); } break; case "4": //Album3 strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]); if (strApplicationID != null) { byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Album3); } break; case "5": //Horoscope strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]); if (strApplicationID != null) { byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Horoscope); } break; case "6": //SucessStory byteImageArray = MatrimonialAlbumManager.GetImage(Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.SucessStory); break; default: byteImageArray = null; return; } // if image present if (byteImageArray != null) { //resize image if needed switch (Request.QueryString["type"]) { case "124": byteImageArray = EditImage.GetThumbNail(byteImageArray, 124, 124, false); break; case "98": byteImageArray = EditImage.GetThumbNail(byteImageArray, 98, 98, false); break; case "75": byteImageArray = EditImage.GetThumbNail(byteImageArray, 75, 75, false); break; } //displaying image Response.ContentType = "text/HTML"; Response.BinaryWrite(byteImageArray); } else { DisplayError(); } } }
protected void IB_Crop_Click(object sender, ImageClickEventArgs e) { try { MatrimonialAlbumManager.ImageType enuImageType = MatrimonialAlbumManager.ImageType.Photo; switch (Convert.ToSByte(Session["ImageID"])) { case 1: enuImageType = MatrimonialAlbumManager.ImageType.Photo; break; case 2: enuImageType = MatrimonialAlbumManager.ImageType.Album1; break; case 3: enuImageType = MatrimonialAlbumManager.ImageType.Album2; break; case 4: enuImageType = MatrimonialAlbumManager.ImageType.Album3; break; default: Response.Redirect("image.aspx?id=Error"); break; } ///GetImage byte[] byteArray = (byte[])Session["ImageToCrop"]; // Removing image from session Session.Remove("ImageToCrop"); /// Get Application String HttpCookieCollection objHttpCookieCollection = Request.Cookies; HttpCookie objHttpCookie = objHttpCookieCollection.Get("MatCookie5639sb"); string strApplicationID = Crypto.DeCrypto(objHttpCookie.Values["ApplicationID"]); /// crop image byteArray = EditImage.CropImageFile(byteArray, Convert.ToInt32(HiddenW.Value), Convert.ToInt32(HiddenH.Value), Convert.ToInt32(HiddenX.Value), Convert.ToInt32(HiddenY.Value)); /// make thumbnail if (enuImageType == MatrimonialAlbumManager.ImageType.Photo) { byteArray = EditImage.GetThumbNail(byteArray, 128, 128, false); } else { byteArray = EditImage.GetThumbNail(byteArray, 600, 600, true); } /// water mark image byteArray = EditImage.SetWatermark(byteArray, WebConfig.GetValues("FName"), 80, true, 16); //Which image is to be uploaded ? /// Add new image(Insert) or change newimage (Update) ? switch (MatrimonialAlbumManager.IsAlbumExists(strApplicationID)) { case false: // Insert Image into database if (MatrimonialAlbumManager.InsertPhoto(strApplicationID, byteArray, enuImageType)) { Response.Redirect("../Extras/Sucess.aspx"); } else { Response.Redirect("image.aspx?id=Error"); } break; case true: // Update Image if (MatrimonialAlbumManager.InsertPhoto(strApplicationID, byteArray, enuImageType)) { Response.Redirect("../Extras/Sucess.aspx"); } else { Response.Redirect("image.aspx?id=Error"); } break; default: Response.Redirect("imaxge.aspx?id=Error"); break; } } catch (Exception) { } }
protected void Page_Load(object sender, EventArgs e) { if ((Request.QueryString["matid"] == null) || (Request.QueryString["id"] == null)) { } else { HttpCookieCollection objHttpCookieCollection = Request.Cookies; HttpCookie objHttpCookie = objHttpCookieCollection.Get("MatCookie5639sb"); string strMatID = Crypto.DeCrypto(objHttpCookie.Values["MatrimonialID"]); //get image byte[] byteImageArray = null; switch (Request.QueryString["id"]) { case "1": // member photo if (strMatID != null) { byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Photo); } break; case "2": //Album1 if (strMatID != null) { byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Album1); } break; case "3": //Album2 if (strMatID != null) { byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Album2); } break; case "4": //Album3 if (strMatID != null) { byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Album3); } break; case "5": //Horoscope if (strMatID != null) { byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Horoscope); } break; default: byteImageArray = null; return; } // if image present if (byteImageArray != null) { //resize image if needed if (Request.QueryString["type"] == "124") { byteImageArray = EditImage.GetThumbNail(byteImageArray, 124, 124, false); } //displaying image Response.ContentType = "text/HTML"; Response.BinaryWrite(byteImageArray); } else { DisplayError(); //Write ErrorLog ErrorLog.WriteLog("ImagePro byteImageArray=Null"); } } }
private bool UpLoadImageFile(FileInfo info) { /* * UserSuccessStory_InsertStory * * @SStoryID varchar(15) = NULL, * @MatrimonialID varchar(10) = NULL, * @Bride varchar(50) = NULL, * @Groom varchar(50) = NULL, * @WeddingDate smalldatetime = NULL, * @Photo image = NULL */ try { /// /// striming image /// byte[] byteContent = new byte[info.Length]; FileStream objFileStream = info.OpenRead(); objFileStream.Read(byteContent, 0, byteContent.Length); objFileStream.Close(); /// /// Processing image /// byteContent = EditImage.GetThumbNail(byteContent, 124, 90, true); byteContent = EditImage.SetWatermark(byteContent, WebConfig.GetValues("FName"), 50, true, 36); /// /// DataBase operation starts /// using (SqlConnection objConnection = DBConnection.GetSqlConnection()) { SqlCommand objCommand = new SqlCommand("UserSuccessStory_InsertStory", objConnection); objCommand.CommandType = CommandType.StoredProcedure; /// Inserting parameters string strTemp = getSucessID(); objCommand.Parameters.Add(new SqlParameter("@SStoryID", SqlDbType.VarChar)); objCommand.Parameters["@SStoryID"].Value = strTemp; objCommand.Parameters.Add(new SqlParameter("@SucessStory", SqlDbType.VarChar)); objCommand.Parameters["@SucessStory"].Value = TB_SucessStory.Text; objCommand.Parameters.Add(new SqlParameter("@MatrimonialID", SqlDbType.VarChar)); objCommand.Parameters["@MatrimonialID"].Value = TB_MatID.Text; objCommand.Parameters.Add(new SqlParameter("@Bride", SqlDbType.VarChar)); objCommand.Parameters["@Bride"].Value = TB_Bride.Text; objCommand.Parameters.Add(new SqlParameter("@Groom", SqlDbType.VarChar)); objCommand.Parameters["@Groom"].Value = TB_Groom.Text; /// <<<<<<<<<<<< ForTesting >>>>>>>>>>>> objCommand.Parameters.Add(new SqlParameter("@WeddingDate", SqlDbType.SmallDateTime)); objCommand.Parameters["@WeddingDate"].Value = DateTime.Parse(TB_Date.Text); objCommand.Parameters.Add(new SqlParameter("@Photo", SqlDbType.Image)); objCommand.Parameters["@Photo"].Value = byteContent; /// Execute Sql Query objConnection.Open(); objCommand.ExecuteNonQuery(); objConnection.Close(); //Setting SuccessPannel PN_Success.Visible = true; SuccessPannel1.Bind(strTemp); } return(true); } catch (Exception) { // ErrorLog return(false); } }
private bool UpLoadImageFile(FileInfo info) { /* * UserAlbum_UpdateHoroscope * UserAlbum_InsertImage * * @ApplicationID varchar(15) * @Horoscope image */ try { /// /// striming image /// byte[] byteContent = new byte[info.Length]; FileStream objFileStream = info.OpenRead(); objFileStream.Read(byteContent, 0, byteContent.Length); objFileStream.Close(); /// /// Processing image /// byteContent = EditImage.GetThumbNail(byteContent, 600, 600, true); byteContent = EditImage.SetWatermark(byteContent, WebConfig.GetValues("FName"), 50, true, 36); /// /// DataBase operation starts /// string strApplicationID = MatrimonialMemberShip.GetApplicationID(TB_MatrimonialID.Text); using (SqlConnection objConnection = DBConnection.GetSqlConnection()) { SqlCommand objCommand = new SqlCommand("UserAlbum_InsertImage", objConnection); if (MatrimonialAlbumManager.IsAlbumExists(strApplicationID)) { objCommand = new SqlCommand("UserAlbum_UpdateHoroscope", objConnection); } objCommand.CommandType = CommandType.StoredProcedure; /// Inserting parameters objCommand.Parameters.Add(new SqlParameter("@ApplicationID", SqlDbType.VarChar)); objCommand.Parameters["@ApplicationID"].Value = strApplicationID; objCommand.Parameters.Add(new SqlParameter("@Horoscope", SqlDbType.Image)); objCommand.Parameters["@Horoscope"].Value = byteContent; /// Execute Sql Query objConnection.Open(); objCommand.ExecuteNonQuery(); objConnection.Close(); } return(true); } catch (Exception Ex) { ErrorLog.WriteErrorLog("Admin_Protected_DeleteHoroscope", Ex); return(false); } }
private bool UpLoadImageFile(FileInfo info) { /* * UserAlbum_UpdateHoroscope * UserAlbum_InsertImage * * @ApplicationID varchar(15) * @Horoscope image * @HoroPassword Varchar(25) */ try { /// /// striming image /// byte[] byteContent = new byte[info.Length]; FileStream objFileStream = info.OpenRead(); objFileStream.Read(byteContent, 0, byteContent.Length); objFileStream.Close(); /// /// Processing image /// byteContent = EditImage.GetThumbNail(byteContent, 600, 600, true); byteContent = EditImage.SetWatermark(byteContent, WebConfig.GetValues("FName"), 50, true, 36); /// /// DataBase operation starts /// HttpCookieCollection objHttpCookieCollection = Request.Cookies; HttpCookie objHttpCookie = objHttpCookieCollection.Get("MatCookie5639sb"); string strApplicationID = Crypto.DeCrypto(objHttpCookie.Values["ApplicationID"]); using (SqlConnection objConnection = DBConnection.GetSqlConnection()) { SqlCommand objCommand = new SqlCommand("UserAlbum_InsertImage", objConnection); if (MatrimonialAlbumManager.IsAlbumExists(strApplicationID)) { objCommand = new SqlCommand("UserAlbum_UpdateHoroscope", objConnection); } objCommand.CommandType = CommandType.StoredProcedure; /// Inserting parameters objCommand.Parameters.Add(new SqlParameter("@ApplicationID", SqlDbType.VarChar)); objCommand.Parameters["@ApplicationID"].Value = strApplicationID; objCommand.Parameters.Add(new SqlParameter("@Horoscope", SqlDbType.Image)); objCommand.Parameters["@Horoscope"].Value = byteContent; if (!RB_H_No.Checked) { objCommand.Parameters.Add(new SqlParameter("@HoroPassword", SqlDbType.VarChar)); objCommand.Parameters["@HoroPassword"].Value = TB_Password.Text; } /// Execute Sql Query objConnection.Open(); objCommand.ExecuteNonQuery(); objConnection.Close(); } return(true); } catch (Exception ex) { // ErrorLog return(false); } }