RestImageResize/OpenWaveRestApiEncoder.cs
/// <summary>
/// Encodes the URI to OpenWave image transformation URI.
/// </summary>
/// <param name="uri">The target URI.</param>
/// <returns>
/// Transformed URI instance.
/// </returns>
Encodes the URI to OpenWave image transformation URI.
Encodes the URI to OpenWave image transformation URI .
public Uri EncodeUri(Uri uri)
        {
            if (!IsSupportedUri(uri))
            {
                return uri;
            }
            var transformQuery = ImageTransformQuery.FromQueryString(uri.GetQueryString(), DefaultImageTransform);
            EnsureAuthorizedQuery(transformQuery);
            var transformation = ImageTransformationFactory.TryCreate(transformQuery);
            if (transformation == null)
                return uri;
            var url = ImageTransformationService.GetTransformedImageUrl(Url.Parse(uri.ToString()), transformation);
            return new Uri(url.ToString(), UriKind.RelativeOrAbsolute);
        }
public Uri EncodeUri ( Uri uri ) { if ( ! IsSupportedUri ( uri ) ) { return uri ; } var transformQuery = ImageTransformQuery . FromQueryString ( uri . GetQueryString ( ) , DefaultImageTransform ) ; EnsureAuthorizedQuery ( transformQuery ) ; var transformation = ImageTransformationFactory . TryCreate ( transformQuery ) ; if ( transformation == null ) return uri ; var url = ImageTransformationService . GetTransformedImageUrl ( Url . Parse ( uri . ToString ( ) ) , transformation ) ; return new Uri ( url . ToString ( ) , UriKind . RelativeOrAbsolute ) ; }
Encodes the URI to OpenWave image transformation URI.
Encodes the URI to OpenWave image transformation URI .
//var transformBuilder = ImageTransformationBuilderFactory.CreateBuilder(); //transformBuilder.Width = transformQuery.Width; //transformBuilder.Height = transformQuery.Height; //transformBuilder.TransformType = transformQuery.Transform; //transformBuilder.FocusPoint = transformQuery.FocusPoint;
Transformed URI instance.
Transformed URI instance .
uri
Uri
The target URI.
The target URI .