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 394 posts 1477 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 438 posts 1818 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 394 posts 1477 karma points
    Dec 21, 2020 @ 15:59
    Paul de Quant
    0

    Hi Bo,

    Thanks for this, this is great.

    Cheers

  • Bo Jacobsen 438 posts 1818 karma points
    Dec 21, 2020 @ 20:17
    Bo Jacobsen
    0

    You are welcome :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies