Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul de Quant 403 posts 1520 karma points
    Dec 16, 2020 @ 11:42
    Paul de Quant
    0

    Image Cropper Profiles (V8)

    Hello,

    Is it possible to obtain the list of all available image cropper profiles? We would like the editor to be able to specify which Image cropped profile to use in order for us to pass this value in to the GetCropUrl function.

    Is this possible?

    Thanks

  • Bo Jacobsen 597 posts 2395 karma points
    Dec 16, 2020 @ 12:57
    Bo Jacobsen
    100

    If i understand your question correctly, then it is possible.

    Here is very simplified example:

    using Umbraco.Core.Models;
    using Umbraco.Core.PropertyEditors;
    
    public class CustomService : ICustomService
    {
        private readonly IDataTypeService _dataTypeService;
    
        public CustomService(IDataTypeService dataTypeService)
        {
            _dataTypeService = dataTypeService;
        }
    
        public ImageCropperConfiguration ImageCropperPrevalues(string dataTypeKey = "Image Primary Cropper")
        {
            IDataType dataType = _dataTypeService.GetDataType(dataTypeKey);
            return dataType.ConfigurationAs<ImageCropperConfiguration>();
        }
    }
    
  • Paul de Quant 403 posts 1520 karma points
    Dec 21, 2020 @ 15:59
    Paul de Quant
    0

    Hi Bo,

    Thanks for this, this is great.

    Cheers

  • Bo Jacobsen 597 posts 2395 karma points
    Dec 21, 2020 @ 20:17
    Bo Jacobsen
    0

    You are welcome :)

Please Sign in or register to post replies

Write your reply to:

Draft