public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "v1/exifdata")] HttpRequest req,
            ILogger log)
        {
            var metadata = ExifHelper.GetMetadata(req.Body);

            if (metadata == null)
            {
                return(new NotFoundResult());
            }

            return(new OkObjectResult(metadata));
        }
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "v1/name")] HttpRequest req,
            ILogger log)
        {
            var filename     = (string)req.Query["filename"];
            var nameTemplate = (string)req.Query["template"] ?? "{{ FileName }}{{ Extension }}";

            var tmpl     = Template.Parse(nameTemplate);
            var metadata = ExifHelper.GetMetadata(req.Body);

            metadata["FileName"]      = Path.GetFileNameWithoutExtension(filename);
            metadata["Extension"]     = Path.GetExtension(filename);
            metadata["FileNameClean"] = FilenameHelper.Fix(Path.GetFileNameWithoutExtension(filename));


            var rendered = tmpl.Render(metadata);

            return(new OkObjectResult(new
            {
                Filename = string.Concat(rendered.Split(Path.GetInvalidFileNameChars()))
            }));
        }