Example #1
0
 public ImageService(IWebsite website, IImageStorage imageStorage, IImageRepository imageRepository, ITransactionManager transactionManager)
 {
     this._website = website;
     this._imageStorage = imageStorage;
     this._imageRepository = imageRepository;
     this._transactionManager = transactionManager;
 }
        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);
            }
        }
Example #3
0
		public RequestHelper(HttpRequest request, IImageStorage storage)
		{
			if (request == null) throw new ArgumentNullException("request");

			_request = request;
			_storage = storage;
			_ParseRequest();
		}
        public ImageProcessingJobs(IImageStorage storage)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }

            this.storage = storage;
        }
        public Cleanup(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;
        }
Example #7
0
        /// <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);

        }
Example #8
0
        /// <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;
 }
Example #10
0
        /// <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
            {

            }
        }
Example #11
0
        /// <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);

            }
        }