Esempio n. 1
0
        /// <summary>
        /// Получение фотографии
        /// </summary>
        /// <param name="photoId">Идентификатор фотографии</param>
        /// <returns></returns>
        public byte[] GetPhoto(int photoId, string photoPath)
        {
            try
            {
                var textAttributes = _textAttrService.GetAll().FirstOrDefault();
                var watermark      = _watermarkService.GetAll().FirstOrDefault(x => x.PhotoId == photoId);

                if (textAttributes == null)
                {
                    textAttributes = new Data.Entities.TextAttributes()
                    {
                        WatermarkFont     = "Bell MT",
                        WatermarkFontSize = 60,
                        WatermarkText     = "*****@*****.**",
                        SignatureFont     = "Edwardian Script ITC",
                        SignatureFontSize = 43,
                        SignatureText     = "© Alexander Serebryakov",
                        StampFont         = "Bell MT",
                        StampFontSize     = 45,
                        StampText         = "www.askanio.ru",
                        Alpha             = 80
                    }
                }
                ;

                var imageAttributes = new ImageAttrModel(watermark);

                return(new ImageProcessor(photoPath, Settings.Default.ThumbPath, textAttributes).Watermark(imageAttributes));
            }
            catch (Exception ex)
            {
                Log.RegisterError(ex);
                return(null);
            }
        }
        public ActionResult Index()
        {
            var attr  = _attrService.GetAll().FirstOrDefault();
            var model = _converterAttr.ConvertTo(attr) ??
                        new TextAttributeModel()
            {
                WatermarkFont     = "Bell MT",
                WatermarkFontSize = 60,
                WatermarkText     = "*****@*****.**",
                SignatureFont     = "Edwardian Script ITC",
                SignatureFontSize = 43,
                SignatureText     = "© Alexander Serebryakov",
                StampFont         = "Bell MT",
                StampFontSize     = 45,
                StampText         = "www.askanio.ru",
                Alpha             = 80
            };

            return(View(model));
        }