/// <summary>
 /// Gets the underlying image processing service URL from the MediaWithCrops item.
 /// </summary>
 /// <param name="mediaWithCrops">The MediaWithCrops item.</param>
 /// <param name="width">The width of the output image.</param>
 /// <param name="height">The height of the output image.</param>
 /// <param name="propertyAlias">Property alias of the property containing the JSON data.</param>
 /// <param name="cropAlias">The crop alias.</param>
 /// <param name="quality">Quality percentage of the output image.</param>
 /// <param name="imageCropMode">The image crop mode.</param>
 /// <param name="imageCropAnchor">The image crop anchor.</param>
 /// <param name="preferFocalPoint">Use focal point, to generate an output image using the focal point instead of the predefined crop.</param>
 /// <param name="useCropDimensions">Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.</param>
 /// <param name="cacheBuster">Add a serialized date of the last edit of the item to ensure client cache refresh when updated.</param>
 /// <param name="furtherOptions">These are any query string parameters (formatted as query strings) that the underlying image processing service supports. For example:
 /// <example><![CDATA[
 /// furtherOptions: "bgcolor=fff"
 /// ]]></example></param>
 /// <param name="urlMode">The url mode.</param>
 /// <returns>
 /// The URL of the cropped image.
 /// </returns>
 public static string?GetCropUrl(
     this MediaWithCrops mediaWithCrops,
     int?width                       = null,
     int?height                      = null,
     string propertyAlias            = Cms.Core.Constants.Conventions.Media.File,
     string?cropAlias                = null,
     int?quality                     = null,
     ImageCropMode?imageCropMode     = null,
     ImageCropAnchor?imageCropAnchor = null,
     bool preferFocalPoint           = false,
     bool useCropDimensions          = false,
     bool cacheBuster                = true,
     string?furtherOptions           = null,
     UrlMode urlMode                 = UrlMode.Default)
 => mediaWithCrops.GetCropUrl(
     ImageUrlGenerator,
     PublishedValueFallback,
     PublishedUrlProvider,
     width,
     height,
     propertyAlias,
     cropAlias,
     quality,
     imageCropMode,
     imageCropAnchor,
     preferFocalPoint,
     useCropDimensions,
     cacheBuster,
     furtherOptions,
     urlMode
     );
Example #2
0
        public static IHtmlString GetCropUrl(this UrlHelper urlHelper,
                                             MediaWithCrops mediaWithCrops,
                                             int?width                       = null,
                                             int?height                      = null,
                                             string propertyAlias            = Umbraco.Core.Constants.Conventions.Media.File,
                                             string cropAlias                = null,
                                             int?quality                     = null,
                                             ImageCropMode?imageCropMode     = null,
                                             ImageCropAnchor?imageCropAnchor = null,
                                             bool preferFocalPoint           = false,
                                             bool useCropDimensions          = false,
                                             bool cacheBuster                = true,
                                             string furtherOptions           = null,
                                             ImageCropRatioMode?ratioMode    = null,
                                             bool upScale                    = true,
                                             bool htmlEncode                 = true)
        {
            if (mediaWithCrops == null)
            {
                return(EmptyHtmlString);
            }

            var url = mediaWithCrops.GetCropUrl(width, height, propertyAlias, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode, upScale);

            return(CreateHtmlString(url, htmlEncode));
        }
 /// <summary>
 /// Gets the underlying image processing service URL by the crop alias (from the "umbracoFile" property alias in the MediaWithCrops content item) on the MediaWithCrops item.
 /// </summary>
 /// <param name="mediaWithCrops">The MediaWithCrops item.</param>
 /// <param name="cropAlias">The crop alias e.g. thumbnail.</param>
 /// <param name="imageUrlGenerator">The image URL generator.</param>
 /// <param name="publishedValueFallback">The published value fallback.</param>
 /// <param name="publishedUrlProvider">The published URL provider.</param>
 /// <param name="urlMode">The url mode.</param>
 /// <returns>
 /// The URL of the cropped image.
 /// </returns>
 public static string?GetCropUrl(
     this MediaWithCrops mediaWithCrops,
     string cropAlias,
     IImageUrlGenerator imageUrlGenerator,
     IPublishedValueFallback publishedValueFallback,
     IPublishedUrlProvider publishedUrlProvider,
     UrlMode urlMode = UrlMode.Default) => mediaWithCrops.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, cropAlias: cropAlias, useCropDimensions: true, urlMode: urlMode);
        /// <summary>
        /// Gets the underlying image processing service URL from the MediaWithCrops item.
        /// </summary>
        /// <param name="mediaWithCrops">The MediaWithCrops item.</param>
        /// <param name="imageUrlGenerator">The image URL generator.</param>
        /// <param name="publishedValueFallback">The published value fallback.</param>
        /// <param name="publishedUrlProvider">The published URL provider.</param>
        /// <param name="width">The width of the output image.</param>
        /// <param name="height">The height of the output image.</param>
        /// <param name="propertyAlias">Property alias of the property containing the JSON data.</param>
        /// <param name="cropAlias">The crop alias.</param>
        /// <param name="quality">Quality percentage of the output image.</param>
        /// <param name="imageCropMode">The image crop mode.</param>
        /// <param name="imageCropAnchor">The image crop anchor.</param>
        /// <param name="preferFocalPoint">Use focal point, to generate an output image using the focal point instead of the predefined crop.</param>
        /// <param name="useCropDimensions">Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.</param>
        /// <param name="cacheBuster">Add a serialized date of the last edit of the item to ensure client cache refresh when updated.</param>
        /// <param name="furtherOptions">These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
        /// <example><![CDATA[
        /// furtherOptions: "bgcolor=fff"
        /// ]]></example></param>
        /// <param name="urlMode">The url mode.</param>
        /// <returns>
        /// The URL of the cropped image.
        /// </returns>
        public static string?GetCropUrl(
            this MediaWithCrops mediaWithCrops,
            IImageUrlGenerator imageUrlGenerator,
            IPublishedValueFallback publishedValueFallback,
            IPublishedUrlProvider publishedUrlProvider,
            int?width                       = null,
            int?height                      = null,
            string propertyAlias            = Constants.Conventions.Media.File,
            string?cropAlias                = null,
            int?quality                     = null,
            ImageCropMode?imageCropMode     = null,
            ImageCropAnchor?imageCropAnchor = null,
            bool preferFocalPoint           = false,
            bool useCropDimensions          = false,
            bool cacheBuster                = true,
            string?furtherOptions           = null,
            UrlMode urlMode                 = UrlMode.Default)
        {
            if (mediaWithCrops == null)
            {
                throw new ArgumentNullException(nameof(mediaWithCrops));
            }

            return(mediaWithCrops.Content.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, mediaWithCrops.LocalCrops, false, width, height, propertyAlias, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, urlMode));
        }
Example #5
0
        public static IHtmlString GetCropUrl(this UrlHelper urlHelper, MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias, bool htmlEncode = true)
        {
            if (mediaWithCrops == null)
            {
                return(EmptyHtmlString);
            }

            var url = mediaWithCrops.GetCropUrl(propertyAlias: propertyAlias, cropAlias: cropAlias, useCropDimensions: true);

            return(CreateHtmlString(url, htmlEncode));
        }
 public static string GetCropUrl(
     this MediaWithCrops mediaWithCrops,
     int?width                       = null,
     int?height                      = null,
     string propertyAlias            = Constants.Conventions.Media.File,
     string cropAlias                = null,
     int?quality                     = null,
     ImageCropMode?imageCropMode     = null,
     ImageCropAnchor?imageCropAnchor = null,
     bool preferFocalPoint           = false,
     bool useCropDimensions          = false,
     bool cacheBuster                = true,
     string furtherOptions           = null,
     ImageCropRatioMode?ratioMode    = null,
     bool upScale                    = true) => ImageCropperTemplateCoreExtensions.GetCropUrl(mediaWithCrops, Current.ImageUrlGenerator, width, height, propertyAlias, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode, upScale);
Example #7
0
        public static string GetCropUrl(
            this MediaWithCrops mediaWithCrops,
            IImageUrlGenerator imageUrlGenerator,
            int?width                       = null,
            int?height                      = null,
            string propertyAlias            = Constants.Conventions.Media.File,
            string cropAlias                = null,
            int?quality                     = null,
            ImageCropMode?imageCropMode     = null,
            ImageCropAnchor?imageCropAnchor = null,
            bool preferFocalPoint           = false,
            bool useCropDimensions          = false,
            bool cacheBuster                = true,
            string furtherOptions           = null,
            ImageCropRatioMode?ratioMode    = null,
            bool upScale                    = true)
        {
            if (mediaWithCrops == null)
            {
                throw new ArgumentNullException(nameof(mediaWithCrops));
            }

            return(mediaWithCrops.Content.GetCropUrl(imageUrlGenerator, mediaWithCrops.LocalCrops, false, width, height, propertyAlias, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode, upScale));
        }
Example #8
0
 public static string GetLocalCropUrl(this MediaWithCrops mediaWithCrops, string alias, IImageUrlGenerator imageUrlGenerator, string cacheBusterValue)
 {
     return(mediaWithCrops.LocalCrops.Src + mediaWithCrops.LocalCrops.GetCropUrl(alias, imageUrlGenerator, cacheBusterValue: cacheBusterValue));
 }
 public static string GetLocalCropUrl(this MediaWithCrops mediaWithCrops,
                                      string alias,
                                      string cacheBusterValue = null)
 => ImageCropperTemplateCoreExtensions.GetLocalCropUrl(mediaWithCrops, alias, Current.ImageUrlGenerator, cacheBusterValue);
 /// <summary>
 /// Gets the underlying image processing service URL by the crop alias using the specified property containing the image cropper JSON data on the MediaWithCrops content item.
 /// </summary>
 /// <param name="mediaWithCrops">The MediaWithCrops item.</param>
 /// <param name="propertyAlias">The property alias of the property containing the JSON data e.g. umbracoFile.</param>
 /// <param name="cropAlias">The crop alias e.g. thumbnail.</param>
 /// <param name="urlMode">The url mode.</param>
 /// <returns>
 /// The URL of the cropped image.
 /// </returns>
 public static string?GetCropUrl(this MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias, UrlMode urlMode = UrlMode.Default)
 => ImageCropperTemplateCoreExtensions.GetCropUrl(mediaWithCrops, propertyAlias, cropAlias, ImageUrlGenerator, PublishedValueFallback, PublishedUrlProvider, urlMode);
 public static string GetLocalCropUrl(
     this MediaWithCrops mediaWithCrops,
     string alias,
     string?cacheBusterValue = null) => mediaWithCrops.LocalCrops.Src + mediaWithCrops.LocalCrops.GetCropUrl(alias, ImageUrlGenerator, cacheBusterValue: cacheBusterValue);
Example #12
0
 public static string GetCropUrl(this MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias, IImageUrlGenerator imageUrlGenerator)
 {
     return(mediaWithCrops.GetCropUrl(imageUrlGenerator, propertyAlias: propertyAlias, cropAlias: cropAlias, useCropDimensions: true));
 }
 /// <summary>
 ///     Gets the underlying image processing service URL by the crop alias (from the "umbracoFile" property alias in the
 ///     MediaWithCrops content item) on the MediaWithCrops item.
 /// </summary>
 /// <param name="mediaWithCrops">The MediaWithCrops item.</param>
 /// <param name="cropAlias">The crop alias e.g. thumbnail.</param>
 /// <param name="urlMode">The url mode.</param>
 /// <returns>
 ///     The URL of the cropped image.
 /// </returns>
 public static string?GetCropUrl(this MediaWithCrops mediaWithCrops, string cropAlias, UrlMode urlMode = UrlMode.Default)
 => mediaWithCrops.GetCropUrl(cropAlias, ImageUrlGenerator, PublishedValueFallback, PublishedUrlProvider, urlMode);
 public static string GetCropUrl(this MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias) => ImageCropperTemplateCoreExtensions.GetCropUrl(mediaWithCrops, propertyAlias, cropAlias, Current.ImageUrlGenerator);