public void Process(AttachArgs args)
        {
            MediaItem mi = args.MediaItem;

            try
            {
                CrunchOptions crunchOptions;
                if (mi != null)
                {
                    crunchOptions = new CrunchOptions();
                    FillSetting   objFillSetting    = new FillSetting();
                    TenantSetting objTennantSetting = objFillSetting.getSetting(mi.MediaPath, mi.Database.Name, mi.InnerItem.Language.ToString());
                    if (mi.Size > objTennantSetting.MinimumKBSize && mi.Size < objTennantSetting.MaxImageSize)
                    {
                        crunchOptions.APIKey    = objTennantSetting.ApiKey;
                        crunchOptions.APISecret = objTennantSetting.ApiSecret;
                        crunchOptions.fullname  = mi.Name + "." + mi.Extension;
                        crunchOptions.IsEnabled = objTennantSetting.IsEnabled;
                        crunchOptions.wait      = true;
                        crunchOptions.lossy     = objTennantSetting.Lossy;
                        crunchOptions.dev       = objTennantSetting.IsDev;
                        crunchOptions.enhance   = objTennantSetting.Enhance;
                        CrunchImage.ProcessMediaItem(mi, crunchOptions);
                    }
                    else
                    {
                        Log.Info(string.Format("Image Size is {0} {1}", mi.Size, ",KB which is not fit in minimum & maximum size defined in setting"), this);
                    }
                }
            }
            catch (System.Exception exception)
            {
                Log.Error(string.Format("Could not shrink item {0}", mi.InnerItem.Paths.FullPath), exception, this);
            }
        }
Пример #2
0
        public void Process(AttachArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            UpdateItem(new List <Item>
            {
                args.MediaItem
            });
        }
Пример #3
0
        public void Process(AttachArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!args.MediaItem.FileBased)
                return;

            var helper = new PipelineHelper();
            helper.StartMediaProcessorJob(new List<Item> { args.MediaItem });
        }
        public void Process(AttachArgs args)
        {
            //if (!args.MediaItem.FileBased && (!this.IsRestrictedExtension(args.File.FileName) || args.File.InputStream.Length > ImageAttachMaxSize.MaxImageSizeInDatabase))
            //    throw new ClientAlertException(string.Format("The file is too big to be attached. The maximum size of a file that can be uploaded is {0}.", (object)MainUtil.FormatSize(ImageAttachMaxSize.MaxImageSizeInDatabase)));

            if (this.IsRestrictedExtension(args.File.FileName) && args.File.InputStream.Length > ImageAttachMaxSize.MaxImageSizeInDatabase)
            {
                throw new ClientAlertException(string.Format("The file is too big to be attached. The maximum size of a file that can be uploaded is {0}.", (object)MainUtil.FormatSize(ImageAttachMaxSize.MaxImageSizeInDatabase)));
            }
        }
Пример #5
0
        /// <summary>
        /// Deletes media from Cloud storage that was previously associated with item
        /// </summary>
        /// <param name="args"></param>
        public void Process(AttachArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!args.MediaItem.FileBased)
                return;

            Log.Audit("Deleting '{0}' from Cloud storage".FormatWith(args.MediaItem.FilePath), this);
            cloudStorage.Delete(args.MediaItem);
        }
        /// <summary>
        /// Deletes media from Cloud storage that was previously associated with item
        /// </summary>
        /// <param name="args"></param>
        public void Process(AttachArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!args.MediaItem.FileBased)
            {
                return;
            }

            Log.Audit("Deleting '{0}' from Cloud storage".FormatWith(args.MediaItem.FilePath), this);
            cloudStorage.Delete(args.MediaItem);
        }
        /// <summary>
        /// Deletes media from Cloud storage that was previously associated with item
        /// </summary>
        /// <param name="args"></param>
        public void Process(AttachArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!args.MediaItem.FileBased)
            {
                return;
            }

            _logManager.LogAudit("Deleting '{0}' from Cloud storage".FormatWith(args.MediaItem.FilePath), GetType());

            PipelineHelper.AddContainerNameToArgs(args, GetContainerNameFromFilePath(args.MediaItem.FilePath));
            _cloudStorage.Delete(args.MediaItem);
        }
        public void Process(AttachArgs args)
        {
            if (args?.MediaItem == null)
            {
                return;
            }

            var item = args.MediaItem.InnerItem;

            // Should replace this with a pipeline or similar
            var contentExtractor = new PdfContentExtractor();

            contentExtractor.LoadItemWithMetaData(item);
        }
        public void Process(AttachArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!args.MediaItem.FileBased)
            {
                return;
            }

            var helper = new PipelineHelper();

            helper.StartMediaProcessorJob(new List <Item> {
                args.MediaItem
            });
        }
        public void Process(AttachArgs args)
        {
            if (UploadFileSettings.IsAllowedFile(args.FileWrapper))
            {
                return;
            }

            string errorMessage = UploadFileSettings.FileErrorMessage(args.FileWrapper.FileName);


            HttpContext.Current.Response.Write(
                "<html><head><script type=\"text/JavaScript\" language=\"javascript\">window.top.scForm.getTopModalDialog().frames[0].scForm.postRequest(\"\", \"\", \"\", 'ShowAlert(\"" +
                errorMessage + "\")')</script></head><body>Done</body></html>");

            args.AbortPipeline();
        }