コード例 #1
0
 public ImageGalleryUploadFileController(ILogger <ImageGalleryUploadFileController> logger,
                                         IDynamicImageUtility dynamicImageUtility,
                                         IUmbrellaWebHostingEnvironment umbrellaHostingEnvironment)
     : base(logger)
 {
     m_DynamicImageUtility        = dynamicImageUtility;
     m_UmbrellaHostingEnvironment = umbrellaHostingEnvironment;
 }
コード例 #2
0
        public override void UpdateEditor(global::N2.ContentItem item, Control editor)
        {
            LinkItemCollection coll = LinkItemCollection.FindByPageAndPropertyName(item, Name);

            ImageGalleryControl ctrl = ((ImageGalleryControl)editor);

            IDynamicImageUtility dynamicImageUtility = GetDynamicImageUtility();

            //Need to convert the ImageItem objects to ImageGalleryItemEditDTO objects
            List <ImageGalleryItemEditDTO> lstImageGalleryItemEditDTO = coll.Cast <ImageItem>().Select(x =>
            {
                var dto          = ImageGalleryAutoMapperMappings.Instance.Map <ImageGalleryItemEditDTO>(x);
                dto.ThumbnailUrl = VirtualPathUtility.ToAppRelative(dynamicImageUtility.GenerateVirtualPath(dto.Url, new DynamicImageOptions(dto.Url, 150, 150, DynamicResizeMode.UniformFill, DynamicImageFormat.Jpeg)));

                return(dto);
            }).ToList();

            ctrl.Initialize(JsonConvert.SerializeObject(lstImageGalleryItemEditDTO), coll.Count);
        }