Esempio n. 1
0
        public MediaRenditionInfo Scale(double scale)
        {
            var a = MediaTransformation.Parse(Path);

            var b = new MediaTransformation(a.Source);

            foreach (var transform in a.GetTransforms())
            {
                switch (transform)
                {
                case ResizeTransform resize: b.Apply(resize * scale);      break;

                case CropTransform crop: b.Apply(crop.Scale(scale));   break;

                default: b.Apply(transform);           break;
                }
            }

            return(new MediaRenditionInfo(
                       host: host,
                       sourcePath: b.Source.Key,
                       transformPath: b.GetFullName(),
                       width: b.Width,
                       height: b.Height,
                       seperator: seperator,
                       signer: signer
                       ));
        }
Esempio n. 2
0
 public MediaRenditionInfo(
     string host,
     MediaTransformation transformation,
     char seperator    = ';',
     IUrlSigner signer = null)
     : this(
         host          : host,
         sourcePath    : transformation.Source.Key,
         transformPath : transformation.GetFullName(),
         width         : transformation.Width,
         height        : transformation.Height,
         seperator     : seperator
         )
 {
 }