protected void SubmitButton_Click(object sender, EventArgs e) { if (FileUpLoad.HasFile) { //Set new image row ImageRow newImageRow = new JuggleDrumManager.Rows.ImageRow(IdType.ContentId, ContentID); newImageRow.AltText = this.AltText.Text; try { //Set new image object JuggleDrumManager.Image newImage = new JuggleDrumManager.Image(this.FileUpLoad.FileContent, this.FileUpLoad.FileName); newImage.MaxWidth = 400; newImage.SaveToDisk(); //Set new image row newImageRow.HtmlSrc = System.Text.RegularExpressions.Regex.Match(newImage.Path, @"/images/uploaded/.+").Value; //Update page UserMessage.Text = "<p><em>Image uploaded successfully</em></p>"; DisplayImage.Visible = true; } catch(JuggleDrumManager.PublicMessageException ex) { UserMessage.Text = string.Format("<p><em>{0}</em></p>", ex.Message); } newImageRow.InsertOrUpdateRow(); } }
protected void SubmitButton_Click(object sender, EventArgs e) { if (FileUpLoad.HasFile) { //Set new image row ImageRow newImageRow = new JuggleDrumManager.Rows.ImageRow(IdType.ContentId, ContentID); newImageRow.AltText = this.AltText.Text; try { //Set new image object JuggleDrumManager.Image newImage = new JuggleDrumManager.Image(this.FileUpLoad.FileContent, this.FileUpLoad.FileName); newImage.MaxWidth = 400; newImage.SaveToDisk(); //Set new image row newImageRow.HtmlSrc = System.Text.RegularExpressions.Regex.Match(newImage.Path, @"/images/uploaded/.+").Value; //Update page UserMessage.Text = "<p><em>Image uploaded successfully</em></p>"; DisplayImage.Visible = true; } catch (JuggleDrumManager.PublicMessageException ex) { UserMessage.Text = string.Format("<p><em>{0}</em></p>", ex.Message); } newImageRow.InsertOrUpdateRow(); } }
private void SaveFileToDisk(FileType fileType) { if (fileType == FileType.Image) { //Save orgional: string completePath = Server.MapPath("~/UploadedFiles/UneditedOriginals/") + oAspFileUpload.FileName; oAspFileUpload.PostedFile.SaveAs(completePath); //Edit for web and then save: using ( JuggleDrumManager.Image editedImage = new JuggleDrumManager.Image( oAspFileUpload.PostedFile.InputStream, oAspFileUpload.FileName, Server.MapPath("~/UploadedFiles/")) ) { editedImage.MaxHeight = 300; editedImage.MaxWidth = 300; editedImage.SaveToDisk(); } } else { //Just save staight to the web directory: string completePath = Server.MapPath("~/UploadedFiles/") + oAspFileUpload.FileName; oAspFileUpload.PostedFile.SaveAs(completePath); } }
public string SaveImageAndReturnFileName() { if(oFileUpload.HasFile) { JuggleDrumManager.Image image = new JuggleDrumManager.Image(oFileUpload.FileContent, oFileUpload.FileName); image.MaxHeight = MaxHeight; image.MaxWidth = MaxWidth; image.SaveToDisk(); return image.FileName; } else { return null; } }
public string SaveImageAndReturnFileName() { if (oFileUpload.HasFile) { JuggleDrumManager.Image image = new JuggleDrumManager.Image(oFileUpload.FileContent, oFileUpload.FileName); image.MaxHeight = MaxHeight; image.MaxWidth = MaxWidth; image.SaveToDisk(); return(image.FileName); } else { return(null); } }
private void SaveFileToDisk(FileType fileType) { if (fileType == FileType.Image) { //Save orgional: string completePath = Server.MapPath("~/UploadedFiles/UneditedOriginals/") + oAspFileUpload.FileName; oAspFileUpload.PostedFile.SaveAs(completePath); //Edit for web and then save: using ( JuggleDrumManager.Image editedImage = new JuggleDrumManager.Image( oAspFileUpload.PostedFile.InputStream, oAspFileUpload.FileName, Server.MapPath("~/UploadedFiles/")) ) { editedImage.MaxHeight = 300; editedImage.MaxWidth = 300; editedImage.SaveToDisk(); } } else { //Just save staight to the web directory: string completePath = Server.MapPath("~/UploadedFiles/") + oAspFileUpload.FileName; oAspFileUpload.PostedFile.SaveAs(completePath); } }