Example #1
0
        Image GetImage(string imagePath, string copyrightImageUrl, string copyrightText)
        {
            var image = CommonLogic.LoadImage(imagePath);

            // If copyright image and text are not specified, return the original image untouched.
            if (string.IsNullOrEmpty(copyrightImageUrl) &&
                string.IsNullOrEmpty(copyrightText))
            {
                return(image);
            }

            // Favor the copyright image over text.
            if (!string.IsNullOrEmpty(copyrightImageUrl) && CommonLogic.FileExists(copyrightImageUrl))
            {
                copyrightText = string.Empty;
            }

            try
            {
                return(CommonLogic.AddWatermark(image, copyrightText, copyrightImageUrl));
            }
            catch (Exception ex)
            {
                SysLog.LogException(ex, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
                return(null);
            }
        }