public static string SaveImage(string base64, string slug, int?x = null, int?y = null) { Media media = new Media(); media.Extension = "jpg"; media.FileName = slug + "-" + UniqueIdentifier.Generate(); media.Path = DirectoryHelper.GenerateTodayMediaDirectory(); byte[] imageBytes = Convert.FromBase64String(base64); File.WriteAllBytes(Directory.GetCurrentDirectory() + "/wwwroot" + media.FullPath, imageBytes); // ImageHelper.Compress(media.FullPath, x, y); return(media.FullPath); }
public static string SaveVideo(IFormFile file, string slug) { string str1 = file.FileName.Split('.').Last(); string str2 = DirectoryHelper.GenerateTodayMediaDirectory() + (slug.GenerateSlug() + "-" + UniqueIdentifier.Generate() + "." + str1); using (FileStream fileStream = File.Create(Directory.GetCurrentDirectory() + "\\wwwroot" + str2)) { file.CopyTo(fileStream); fileStream.Flush(); } return(str2); }
public AutoMoveTowardsTarget(PoseTravelData travellingData, IPointableElement pointableElement) { _identifier = UniqueIdentifier.Generate(); _travellingData = travellingData; _pointableElement = pointableElement; }
public static string SaveFile(IFormFile file, string slug = "file") { string str1 = ((IEnumerable <string>)file.FileName.Split('.', StringSplitOptions.None)).Last <string>(); string str2 = DirectoryHelper.GenerateTodayMediaDirectory() + (slug.GenerateSlug() + "-" + UniqueIdentifier.Generate() + "." + str1); using (FileStream fileStream = File.Create(Directory.GetCurrentDirectory() + "\\wwwroot" + str2)) { file.CopyTo((Stream)fileStream); ((Stream)fileStream).Flush(); } return(str2); }