示例#1
0
        private ContentReference CreateFaceMediaFile(ContentAssetFolder contentAssetFolder, ImageData image, byte[] faceResizedImage)
        {
            FaceImageData faceImage = _contentRepositoryInj.Service.GetDefault <FaceImageData>(contentAssetFolder.ContentLink);

            faceImage.Name = $"autogenerated_{image.Name}";

            Blob imageBlob = _blobFactoryInj.Service.CreateBlob(faceImage.BinaryDataContainer, ".png");

            using (Stream blobWriter = imageBlob.OpenWrite())
                using (MemoryStream memoryStream = new MemoryStream(faceResizedImage))
                {
                    memoryStream.CopyTo(blobWriter);
                }
            faceImage.BinaryData = imageBlob;
            ContentReference faceImageId = _contentRepositoryInj.Service.Save(faceImage, EPiServer.DataAccess.SaveAction.Publish);

            return(faceImageId);
        }
示例#2
0
 public async Task <IList <DetectedFace> > AnalyzePicture([FromBody] FaceImageData imageData)
 {
     return(await faceService.DetectFaces(imageData.Image));
 }