public bool SubscribeOnPhoto(bool isSubscribe) { IImageStorage _storage = StorageFactory.GetStorage(); ISubscriptionProvider subscriptionProvider = _storage.NotifySource.GetSubscriptionProvider(); if (IAmAsRecipient == null) { return(false); } if (!isSubscribe) { subscriptionProvider.Subscribe( ASC.PhotoManager.PhotoConst.NewPhotoUploaded, null, IAmAsRecipient ); return(true); } else { subscriptionProvider.UnSubscribe( ASC.PhotoManager.PhotoConst.NewPhotoUploaded, null, IAmAsRecipient ); return(false); } }
public UploadImagesForVideoInteractor(IImageStorage imageStorage, IValidator <UploadImagesForVideoRequestMessage> validator, IRepository repository) { _imageStorage = imageStorage; _validator = validator; _repository = repository; }
public Controller() { //instantiate the _imageMgr field, passing in the _imageProcessor and _imageFactory as parameters - dependency injection _imageMgr = new ImageManager(_imageDict, _imageFactory, _imageProcessor); //Instantiate _model, passing in the _imageMgr - dependency injection _model = new Model(_imageMgr); }
private IFileInfo GetImageFromCache(IImageStorage imageStorage, DateTime requestTime) { KeyValuePair <string, DateTime> cachedPath; IFileInfo fileInfo = null; if (imageChache.TryGetValue(imageStorage.ImagePath, out cachedPath)) { if (requestTime.Subtract(cachedPath.Value).Seconds > MainCfg.MaxImagesMiddlewareCacheSeconds) { if (imageChache.TryRemove(imageStorage.ImagePath, out cachedPath)) { logger.LogTrace( MainCfg.LogEventId, "Path '{0}' was removed from the image cache due to time expiration!", imageStorage.ImagePath); } else { logger.LogInformation( MainCfg.LogEventId, "Couldn't remove the path '{0}' from the image cache due to time expiration!", imageStorage.ImagePath); } } fileInfo = imageStorage.GetImageDirectly(imageStorage.ImagePath); } return(fileInfo); }
public UserController(UserManager <ForumUser> userManager, UserRepository userRepository, IMapper mapper, IImageStorage imageStorage) { this.userManager = userManager; this.userRepository = userRepository; this.mapper = mapper; this.imageStorage = imageStorage; }
public ImageService(IWebsite website, IImageStorage imageStorage, IImageRepository imageRepository, ITransactionManager transactionManager) { this._website = website; this._imageStorage = imageStorage; this._imageRepository = imageRepository; this._transactionManager = transactionManager; }
public ImageController( INotificationHandler <DomainNotification> notifications, IUser user, IImageStorage imageStorage) : base(notifications, user) { _imageStorage = imageStorage; }
protected PhotoCalibratedBoreIntervalVM(SerializationInfo info, StreamingContext context) : base(info, context) { Matrix[] matrices = (Matrix[])info.GetValue("Transforms", typeof(Matrix[])); imageTransforms = matrices.Select(m => (Transform)(new MatrixTransform(m))).ToList(); List <List <CalibratedRegionVM> > regionsList = (List <List <CalibratedRegionVM> >)info.GetValue("Regions", typeof(List <List <CalibratedRegionVM> >)); imageRegions = regionsList.Select(im => (IEnumerable <CalibratedRegionVM>)im).ToList(); imageIDs = (List <Guid>)info.GetValue(nameof(imageIDs), typeof(List <Guid>)); imageNames = (List <string>)info.GetValue(nameof(imageNames), typeof(List <string>)); //TODO: avoid usage of explicit derived type here imageStorage = (IImageStorage)info.GetValue(nameof(imageStorage), typeof(Persistence.FolderImageStorage)); //restoring commands and event subscriptions Initialize(); foreach (var image in imageRegions) { foreach (var region in image) { AttachHandlersToRegionVM(region); } } }
public PostController(PostRepository repository, UserManager <ForumUser> userManager, IMapper mapper, IImageStorage imageStorage) { postRepository = repository; this.userManager = userManager; this.mapper = mapper; this.imageStorage = imageStorage; }
private async Task <IFileInfo> GetImageFromStorageAsync(IImageStorage imageStorage, DateTime requestTime) { IFileInfo fileInfo = null; KeyValuePair <string, DateTime> cacheItem; fileInfo = imageStorage.GetImageDirectly(); if (fileInfo == null || !fileInfo.Exists) { fileInfo = await imageStorage.GetImageVariantAsync(); } if (fileInfo != null && fileInfo.Exists) { if (!imageChache.TryGetValue(imageStorage.ImagePath, out cacheItem)) { cacheItem = new KeyValuePair <string, DateTime>(fileInfo.PhysicalPath, requestTime); if (imageChache.TryAdd(imageStorage.ImagePath, cacheItem)) { logger.LogInformation( MainCfg.LogEventId, "Path '{0}' was succesfully aedded to image cache.", imageStorage.ImagePath); if (imageChache.Count > MainCfg.MaxImagesMiddlewareCachedRequests) { KeyValuePair <string, KeyValuePair <string, DateTime> >?lastCachedItem = imageChache.OrderBy(c => c.Value.Value).LastOrDefault(); if (lastCachedItem.HasValue) { KeyValuePair <string, DateTime> removedCachedValue; if (imageChache.TryRemove(lastCachedItem.Value.Key, out removedCachedValue)) { logger.LogTrace( MainCfg.LogEventId, "Path '{0}' was removed from the image cache due to the maximum value of the cahce items has been exceeded!", imageStorage.ImagePath); } else { logger.LogInformation( MainCfg.LogEventId, "Couldn't remove the path '{0}' from the image cache due the maximum value of the cahce items has been exceeded!", imageStorage.ImagePath); } } } } else { logger.LogInformation(MainCfg.LogEventId, "Couldn't add the path '{0}' to image cache.", imageStorage.ImagePath); } } } return(fileInfo); }
protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(ActionContainer), this.Page); _storage = StorageFactory.GetStorage(); _requestHelper = new RequestHelper(Request, _storage); var currentModule = UserOnlineManager.Instance.GetCurrentModule() as Module; if (currentModule == null) return; var actionsControl = new SideActions(); if (CommunitySecurity.CheckPermissions(ASC.PhotoManager.PhotoConst.Action_AddPhoto) && !MobileDetector.IsRequestMatchesMobile(Context)) { actionsControl.Controls.Add(new NavigationItem() { Name = PhotoManagerResource.UploadPhotosLink, Description = PhotoManagerResource.UploadPhotosLinkDescription, URL = ASC.PhotoManager.PhotoConst.AddPhotoPageUrl + (_requestHelper.EventId != 0 ? "?" + ASC.PhotoManager.PhotoConst.PARAM_EVENT + "=" + _requestHelper.EventId : ""), IsPromo = (SetupInfo.WorkMode == WorkMode.Promo) }); } if (IAmAsRecipient != null) { actionsControl.Controls.Add(new HtmlMenuItem(RenderSubscriptionOnUploadsLink())); } if (IAmAsRecipient != null && _requestHelper.EventId != 0) { actionsControl.Controls.Add(new HtmlMenuItem(RenderSubscriptionOnEventLink(_requestHelper.EventId))); } if (actionsControl.Controls.Count > 0) { _actionHolder.Controls.Add(actionsControl); } if (ActionsPlaceHolder.Controls.Count > 0) { actionsControl.Controls.Add(ActionsPlaceHolder); } if (currentModule.Navigations.Any()) { var navigationControl = new SideNavigator(); foreach (var shortcut in currentModule.Navigations) { if (shortcut.ID == new Guid("4367C1B3-9F22-41a9-9CF1-DDCC612AFEE0") && !SecurityContext.IsAuthenticated) { // skip My Photos for guest continue; } navigationControl.Controls.Add(new NavigationItem() { Name = shortcut.Name, Description = shortcut.Description, URL = shortcut.StartURL }); } _actionHolder.Controls.Add(navigationControl); } }
public RequestHelper(HttpRequest request, IImageStorage storage) { if (request == null) throw new ArgumentNullException("request"); _request = request; _storage = storage; _ParseRequest(); }
public RemoveOfferDraftCommandHandler(IHttpContextAccessor httpContextAccessor, IOfferRepository offerRepository, IImageStorage imageStorage) { _httpContext = httpContextAccessor.HttpContext ?? throw new ArgumentNullException(nameof(httpContextAccessor.HttpContext)); _offerRepository = offerRepository ?? throw new ArgumentNullException(nameof(offerRepository)); _imageStorage = imageStorage ?? throw new ArgumentNullException(nameof(imageStorage)); }
public ImageComparerManager(IImageComparerAlgorithm comparer, IImagePainter painter, IImageStorage imageStorage) { _comparer = comparer; _painter = painter; _imageStorage = imageStorage; }
/// <summary> /// 保存原图片与压缩图片 到磁盘 /// </summary> /// <param name="path">上传图片绝对路径</param> /// <param name="oImageStorage">上传图片对象</param> /// <param name="imagetype">上传图片类型</param> /// <returns></returns> private void saveImage(System.Drawing.Image image, IImageStorage oImageStorage) { bool slImage; System.Drawing.Image objImg = image;//System.Drawing.Image.FromFile(path); ImageRootPath = WebUI.UIBiz.CommonInfo.ImageRootPath; //原图存储路径 string sourcePath = ImageRootPath + "\\" + CurrentUser.UserLoginName + "\\" + oImageStorage.ItemSerialNum + oImageStorage.ImageType; try { string sourceFolder = Path.Combine(ImageRootPath, CurrentUser.UserLoginName); if (!Directory.Exists(sourceFolder)) { // Directory.CreateDirectory(ImageRootPath + "\\" + CurrentUser.UserLoginName); Directory.CreateDirectory(sourceFolder); } //保存原图 this.fuImage.PostedFile.SaveAs(sourcePath); SlImageRootPath = WebUI.UIBiz.CommonInfo.SlImageRootPath170; if (!Directory.Exists(SlImageRootPath + "\\" + CurrentUser.UserLoginName)) { Directory.CreateDirectory(SlImageRootPath + "\\" + CurrentUser.UserLoginName); } // slImage = ImageController.ConvertImageToScale(sourcePath, 170, SlImageRootPath + "\\" + CurrentUser.UserLoginName + "\\" + oImageStorage.ItemSerialNum + oImageStorage.ImageType); ArrayList sarray = new ArrayList(); sarray.Add(sourcePath); ArrayList aarray = new ArrayList(); aarray.Add(SlImageRootPath + "\\" + CurrentUser.UserLoginName + "\\" + oImageStorage.ItemSerialNum + oImageStorage.ImageType); ImageController.ToZipImage(sarray, aarray, 170); SlImageRootPath = WebUI.UIBiz.CommonInfo.SlImageRootPath400; if (!Directory.Exists(SlImageRootPath + "\\" + CurrentUser.UserLoginName)) { Directory.CreateDirectory(SlImageRootPath + "\\" + CurrentUser.UserLoginName); } sarray = new ArrayList(); sarray.Add(sourcePath); aarray = new ArrayList(); aarray.Add(SlImageRootPath + "\\" + CurrentUser.UserLoginName + "\\" + oImageStorage.ItemSerialNum + oImageStorage.ImageType); ImageController.ToZipImage(sarray, aarray, 400); // slImage = ImageController.ConvertImageToScale(sourcePath, 400, SlImageRootPath + "\\" + CurrentUser.UserLoginName + "\\" + oImageStorage.ItemSerialNum + oImageStorage.ImageType); } catch { Response.Write("保存图片出现错误"); } finally { } }
public ImageProcessingJobs(IImageStorage storage) { if (storage == null) { throw new ArgumentNullException("storage"); } this.storage = storage; }
public ShuffleController(IImageStorage imageStorage) { if (imageStorage == null) { throw new ArgumentNullException("imageStorage"); } this.storage = imageStorage; }
public Cleanup(IImageStorage storage) { if (storage == null) { throw new ArgumentNullException("storage"); } this.storage = storage; }
public ClienteAppService(IMapper mapper, IClienteRepository clienteRepository, INotificationHandler <DomainNotification> notifications, IUser user, ILocationAppService locationAppService, IImageStorage imageStorage) { _mapper = mapper; _clienteRepository = clienteRepository; _notifications = (DomainNotificationHandler)notifications; _user = user; _locationAppService = locationAppService; _imageStorage = imageStorage; }
protected BoreIntervalsVM(SerializationInfo info, StreamingContext context) { PhotoCalibratedBoreIntervalVM[] intervalsArray = (PhotoCalibratedBoreIntervalVM[])info.GetValue("Intervals", typeof(PhotoCalibratedBoreIntervalVM[])); intervals = new ObservableCollection <BoreIntervalVM>(intervalsArray.Select(i => (BoreIntervalVM)i)); //TODO: avoid usage of explicit derived type here imageStorage = (IImageStorage)info.GetValue(nameof(imageStorage), typeof(Persistence.FolderImageStorage)); Initialize(); }
public CreateCategoryCommandHandler( ICategoryRepository repository, CategoryFactory factory, IUnitOfWork unitOfWork, IImageStorage imageStorage) { _repository = repository; _factory = factory; _unitOfWork = unitOfWork; _imageStorage = imageStorage; }
public CreateProductCommandHandler( IProductRepository repository, ProductFactory factory, IUnitOfWork unitOfWork, IImageStorage imageStorage) { _repository = repository; _factory = factory; _unitOfWork = unitOfWork; _imageStorage = imageStorage; }
public RequestHelper(HttpRequest request, IImageStorage storage) { if (request == null) { throw new ArgumentNullException("request"); } _request = request; _storage = storage; _ParseRequest(); }
/// <summary> /// Repository for ingest data. /// </summary> /// <param name="context"></param> public IngestRepository(IngestContext context, IImageStorage imageStorage, IMediaStorage mediaStorage, IStreamBuilder streamBuilder, IObjectBus <IEnumerable <ServiceBus.Types.Clip> > clipBus, IObjectBus <ServiceBus.Types.Editor.Podcast> podcastBus) { DbContext = context; ImageStorage = imageStorage; MediaStorage = mediaStorage; StreamBuilder = streamBuilder; ClipBus = clipBus; PodcastBus = podcastBus; }
public ManageController( INotificationHandler <DomainNotification> notifications, UserManager <UserIdentity> userManager, SignInManager <UserIdentity> signInManager, IConfiguration configuration, IMediatorHandler mediator, IImageStorage imageStorage) : base(notifications, mediator) { _userManager = userManager; _signInManager = signInManager; _configuration = configuration; _imageStorage = imageStorage; }
public ProjectVM( IImageStorage imageStorage, ILayersTemplateSource layersTemplateSource, ILayerRankNamesSource layerRankSource, IColumnSettingsPersistence columnSettingsPersister) { boreIntervalsVM = new BoreIntervalsVM(imageStorage); this.layerRankNameSource = layerRankSource; this.layersTemplateSource = layersTemplateSource; columnSettingsPersistence = columnSettingsPersister; Initialize(); }
public UserManagerAppService(IMapper mapper, IUserService userService, IMediatorHandler bus, IEventStoreRepository eventStoreRepository, IImageStorage imageStorage ) { _mapper = mapper; _userService = userService; Bus = bus; _eventStoreRepository = eventStoreRepository; _imageStorage = imageStorage; }
/// <summary> /// 修改图片信息 /// </summary> /// <param name="img"></param> /// <returns></returns> public static bool UpdateImageStorage(IImageStorage img) { ImageStorageService iss = new ImageStorageService(); return(iss.UpdateImageStorage(img.ItemId, img.Caption, img.Address, img.Character, img.StartDate, img.EndDate, img.shotDate, img.Keyword, img.Description)); }
/// <summary> /// 修改图片信息 /// </summary> /// <param name="img"></param> /// <returns></returns> public static bool UpdateImageStorage(IImageStorage img) { ImageStorageService iss = new ImageStorageService(); return iss.UpdateImageStorage(img.ItemId, img.Caption, img.Address, img.Character, img.StartDate, img.EndDate, img.shotDate, img.Keyword, img.Description); }
public ImageStorage2Test() { var layout = new PatternLayout() { ConversionPattern = "%date [%thread] %-5level %logger [%ndc] - %message%newline" }; BasicConfigurator.Configure(new TraceAppender() { Layout = layout, ImmediateFlush = true }); DbRegistry.RegisterDatabase("photo", "System.Data.SQLite", @"Data Source=D:\Work\ASC\MainTrunk\web\studio\ASC.Web.Studio\Products\Community\Modules\PhotoManager\App_Data\images.db3"); store = new ImageStorage2("photo", 0); }
/// <summary> /// Initializes a new instance of the <see cref="SourceImagesModule"/> class. /// </summary> public SourceImagesModule( IImageStorage storage, ISourceContext data) { this.RequiresAnyPermissions(Permissions.WriteSources, Permissions.AdminSources); this.imageService = new SourceImageService(storage, data); this.storage = storage; this.data = data; this.Post("/book/{id}/images", request => this.UploadImages((int)request.id)); this.Post("/brochure/{id}/images", request => this.UploadImages((int)request.id)); this.Delete("image/{publicId*}", this.DeleteImage); this.Post("image/{publicId*}", this.ReorderImages); }
public ImageService(IImageStorage imageStorage, ISettings settings, IEventLog eventLog) { this.imageStorage = imageStorage; this.settings = settings; this.eventLog = eventLog; this.concurrentDictionary = new ConcurrentDictionary <string, object>(); if (!Directory.Exists(TempFolderPath)) { Directory.CreateDirectory(TempFolderPath); } if (!Directory.Exists(CacheFolderPath)) { Directory.CreateDirectory(CacheFolderPath); } }
public ImagePostsController(IImagePostService imagePostService, IRandomImagePostService randomImagePostService, ISearchService searchService, IImageStorage imageStorage, IImageOptimizationService imageOptimizationService, IMapper mapper, ILogger <ImagePostsController> logger, ICurrentUserService currentUserService, INotificationService notificationService) { _imagePostService = imagePostService; _randomImagePostService = randomImagePostService; _searchService = searchService; _imageStorage = imageStorage; _imageOptimizationService = imageOptimizationService; _mapper = mapper; _logger = logger; _currentUserService = currentUserService; _notificationService = notificationService; }
/// <summary> /// 上传其他格式文件方法 /// </summary> public void uploadFile(IImageStorage oImageStorage) { //上传图片的程序段 string strBaseLocation = WebUI.UIBiz.CommonInfo.ImageRootPath; //这是文件将上传到的服务器的绝对目录 //if (this.fuImage.ContentLength > 0) //判断选取对话框选取的文件长度是否为0 ImageUpload.PostedFile.ContentLength != 0 if (this.fuImage.PostedFile.ContentLength > 0) { if (!Directory.Exists(strBaseLocation + "\\" + CurrentUser.UserLoginName)) { Directory.CreateDirectory(strBaseLocation + "\\" + CurrentUser.UserLoginName); } // this.fuImage.MoveTo(strBaseLocation + "\\" + CurrentUser.UserLoginName + "\\" + oImageStorage.ItemSerialNum + "." + oImageStorage.ImageType, Brettle.Web.NeatUpload.MoveToOptions.Overwrite); this.fuImage.SaveAs(strBaseLocation + "\\" + CurrentUser.UserLoginName + "\\" + oImageStorage.ItemSerialNum + oImageStorage.ImageType); } }
/// <summary> /// 根据关键字搜索图片 /// 获取 ItemSerialNum,Hvsp 属性值 /// </summary> /// <returns></returns> public static string AddImageStorage(IImageStorage imgStorage) { ImageStorageService iss = new ImageStorageService(); return iss.AddImageStorage(imgStorage.userId, imgStorage.FileName, imgStorage.FolderName, imgStorage.Caption, imgStorage.Address, imgStorage.Character, imgStorage.StartDate, imgStorage.EndDate, imgStorage.shotDate, imgStorage.Keyword, imgStorage.Description, imgStorage.ImageType, imgStorage.Hvsp, imgStorage.ItemId, imgStorage.ItemSerialNum, imgStorage.GroupId); }
public SponsorsController(IImageStorage imageStorage) { this.imageStorage = imageStorage; }