public async Task <ActionResult <Response> > ProcessAsync(string id) { try { var proxy = _proxyFactory.GetAppContextContentProxy("OwlPhoto"); var content = await proxy.GetAsync(id); var data = await proxy.DownloadDataAsync(id, 0, int.MaxValue); using var ms = new MemoryStream(data); var image = Image.FromStream(ms); // Set width and height content.MetaData.Add("Width", image.Width.ToString()); content.MetaData.Add("Height", image.Height.ToString()); await proxy.UpdateAsync(content); // Create preview var width = 200; var height = (image.Height * width) / image.Width; // crop: "attention" data = ResizeImage(image, width, height); content = new Content { Id = content.Id + "xw100", ContentType = "image/jpeg" }; content.MetaData.Add("Width", width.ToString()); content.MetaData.Add("Height", height.ToString()); content = await proxy.CreateAsync(content); await proxy.AppendDataAsync(content.Id, data); return(new Response { Outcome = Outcomes.Success }); } catch (Exception ex) { return(new Response { Outcome = Outcomes.Failure, Message = ex.Message }); } }