// You can put any business logic associated with this entity here public PictureMetaDataAttribute GetMetaData() { var meta = new PictureMetaDataAttribute(); meta = new DefaultPictureMetaData(); return(meta); }
public static PictureMetaDataAttribute GetPicMetaData() { var meta = new DefaultPictureMetaData(); /* * meta.IsExact = false; * meta.IsCropped = false; * meta.Width = 325; * meta.Height = 244; * meta.ThumbnailWidth = 100; * meta.ThumbnailHeight = 100; */ return(meta); }
public static PictureMetaDataAttribute GetPicMetaData() { var meta = new DefaultPictureMetaData(); meta.IsExact = false; meta.IsCropped = false; meta.Width = 800; meta.IsSmallCropped = false; meta.IsSmallExact = false; meta.SmallHeight = 225; meta.SmallWidth = 225; meta.ThumbnailWidth = 100; meta.ThumbnailHeight = 100; return(meta); //{Width = 123,Height = 456}; }
private string ImageUploader(string type) { string fileName = null; int filesize = 0; try { var file = Request.Files[0]; if (file.ContentLength > 0) { const string subfolder = "paste/"; FileSystem.CreateFolder(Web.Attachments + subfolder); fileName = subfolder + FileSystem.GetUniqueFilename(Web.Attachments + subfolder, file.FileName.RightFrom("\\"), 50); var metaData = new DefaultPictureMetaData() { ThumbnailWidth = 260, ThumbnailHeight = 175, IsThumbnailExact = false, IsThumbnailCropped = false, PreviewWidth = 60, IsExact = false, IsCropped = false, Height = Util.GetSetting("MCEUploadedImageHeight", "960").ToInt(960), Width = Util.GetSetting("MCEUploadedImageWidth", "960").ToInt(960) }; fileName = ImageProcessing.ResizeImageUsingMetaData(fileName, metaData, file); filesize = file.ContentLength; } else { throw new Exception("No file selected"); } } catch (Exception ex) { return("{\"success\": false, \"error\": \"" + ex.Message.Replace("\\", "\\\\") + "\"}"); } if (type == "redactor") { return("{\"filelink\": \"" + Web.Attachments + "paste/" + Path.GetFileName(fileName) + "\"}"); } else { return("{\"success\": true, \"filename\": \"" + Path.GetFileName(fileName) + "\", \"filepath\": \"paste/" + Path.GetFileName(fileName) + "\", \"filesize\": \"" + Fmt.FileSize(filesize, 2) + "\"}"); } }
public string UploadMCE(string b64String, string fileName) { String file = null; String returnResult = null; var metaData = new DefaultPictureMetaData() { ThumbnailWidth = 260, ThumbnailHeight = 175, IsThumbnailExact = false, IsThumbnailCropped = false, PreviewWidth = 60, IsExact = false, IsCropped = false, Height = Util.GetSetting("MCEUploadedImageHeight", "960").ToInt(960), Width = Util.GetSetting("MCEUploadedImageWidth", "960").ToInt(960) }; try { b64String = b64String.Substring(b64String.IndexOf(",") + 1); var bytes = Convert.FromBase64String(b64String); //file = SaveFile("paste", bytes, metaData, fileName.RightFrom("\\")); file = SaveFile("pics", bytes, metaData, fileName.RightFrom("\\")); // MN 20150226 - go directly to correct folder, was staying in paste returnResult = file; } catch (Exception e) { returnResult = "Error uploading file: [" + e.Message + "]"; throw new Beweb.ProgrammingErrorException(returnResult); } return(returnResult); }
public ActionResult GetImageSquare(string imageUrl) { var metaData = new DefaultPictureMetaData(); return(GetImageSized(imageUrl, 120, 120, "_sq")); }
public ActionResult GetImagePreview(string imageUrl) { var metaData = new DefaultPictureMetaData(); return(GetImageSized(imageUrl, metaData.PreviewWidth, metaData.PreviewHeight, "_pv")); }
public ActionResult GetImageThumb(string imageUrl) { var metaData = new DefaultPictureMetaData(); return(GetImageSized(imageUrl, metaData.ThumbnailWidth, metaData.ThumbnailHeight, "_tn")); }
public ActionResult GetImageStandard(string imageUrl) { var metaData = new DefaultPictureMetaData(); return(GetImageSized(imageUrl, metaData.Width, metaData.Height, "_st")); }