public static Watermark GetUserSpecifiedWatermark(int galleryId) { IGallerySettings gallerySetting = Factory.LoadGallerySetting(galleryId); Watermark tempWatermark = new Watermark(); tempWatermark.WatermarkText = gallerySetting.WatermarkText; tempWatermark.TextFontName = gallerySetting.WatermarkTextFontName; tempWatermark.TextColor = HelperFunctions.GetColor(gallerySetting.WatermarkTextColor); tempWatermark.TextHeightPixels = gallerySetting.WatermarkTextFontSize; tempWatermark.TextWidthPercent = gallerySetting.WatermarkTextWidthPercent; tempWatermark.TextOpacityPercent = gallerySetting.WatermarkTextOpacityPercent; tempWatermark.TextLocation = gallerySetting.WatermarkTextLocation; tempWatermark.ImagePath = gallerySetting.WatermarkImagePath; tempWatermark.ImageWidthPercent = gallerySetting.WatermarkImageWidthPercent; tempWatermark.ImageOpacityPercent = gallerySetting.WatermarkImageOpacityPercent; tempWatermark.ImageLocation = gallerySetting.WatermarkImageLocation; return(tempWatermark); }
public static Watermark GetReducedFunctionalityModeWatermark(int galleryId) { IGallerySettings gallerySetting = Factory.LoadGallerySetting(galleryId); Watermark tempWatermark = new Watermark(); tempWatermark.WatermarkText = GalleryServerPro.Business.Properties.Resources.Reduced_Functionality_Mode_Watermark_Text; tempWatermark.TextFontName = gallerySetting.WatermarkTextFontName; tempWatermark.TextColor = HelperFunctions.GetColor(gallerySetting.WatermarkTextColor); tempWatermark.TextHeightPixels = 0; tempWatermark.TextWidthPercent = 100; tempWatermark.TextOpacityPercent = 100; tempWatermark.TextLocation = ContentAlignment.MiddleCenter; tempWatermark._watermarkImage = GalleryServerPro.Business.Properties.Resources.GSP_Logo; tempWatermark.ImageWidthPercent = 85; tempWatermark.ImageOpacityPercent = 50; tempWatermark.ImageLocation = ContentAlignment.BottomCenter; return(tempWatermark); }
private static Watermark GetReducedFunctionalityModeWatermark() { GalleryServerPro.Configuration.Core coreConfig = GalleryServerPro.Configuration.ConfigManager.GetGalleryServerProConfigSection().Core; Watermark tempWatermark = new Watermark(); tempWatermark.WatermarkText = GalleryServerPro.Business.Properties.Resources.Reduced_Functionality_Mode_Watermark_Text; tempWatermark.TextFontName = coreConfig.WatermarkTextFontName; tempWatermark.TextColor = HelperFunctions.GetColor(coreConfig.WatermarkTextColor); tempWatermark.TextHeightPixels = 0; tempWatermark.TextWidthPercent = 100; tempWatermark.TextOpacityPercent = 100; tempWatermark.TextLocation = ContentAlignment.MiddleCenter; tempWatermark._watermarkImage = GalleryServerPro.Business.Properties.Resources.GSP_Logo; tempWatermark.ImageWidthPercent = 40; tempWatermark.ImageOpacityPercent = 80; tempWatermark.ImageLocation = ContentAlignment.BottomCenter; return(tempWatermark); }
private static Watermark GetUserSpecifiedWatermark() { GalleryServerPro.Configuration.Core coreConfig = GalleryServerPro.Configuration.ConfigManager.GetGalleryServerProConfigSection().Core; Watermark tempWatermark = new Watermark(); tempWatermark.WatermarkText = coreConfig.WatermarkText; tempWatermark.TextFontName = coreConfig.WatermarkTextFontName; tempWatermark.TextColor = HelperFunctions.GetColor(coreConfig.WatermarkTextColor); tempWatermark.TextHeightPixels = coreConfig.WatermarkTextFontSize; tempWatermark.TextWidthPercent = coreConfig.WatermarkTextWidthPercent; tempWatermark.TextOpacityPercent = coreConfig.WatermarkTextOpacityPercent; tempWatermark.TextLocation = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), coreConfig.WatermarkTextLocation); tempWatermark.ImagePath = coreConfig.WatermarkImagePath; tempWatermark.ImageWidthPercent = coreConfig.WatermarkImageWidthPercent; tempWatermark.ImageOpacityPercent = coreConfig.WatermarkImageOpacityPercent; tempWatermark.ImageLocation = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), coreConfig.WatermarkImageLocation); return(tempWatermark); }
/// <summary> /// Overlay the text and/or image watermark over the image specified in the <paramref name="filePath" /> parameter and return. /// </summary> /// <param name="filePath">A string representing the full path to the image file /// (e.g. "C:\mypics\myprettypony.jpg", "myprettypony.jpg").</param> /// <param name="galleryId">The gallery ID. The watermark associated with this gallery is applied to the file.</param> /// <returns> /// Returns a System.Drawing.Image instance containing the image with the watermark applied. /// </returns> public static System.Drawing.Image AddWatermark(string filePath, int galleryId) { Watermark wm = Factory.GetWatermarkInstance(galleryId); return(wm.ApplyWatermark(filePath)); }
/// <summary> /// Gets the watermark that is configured for the specified <paramref name="galleryId" />. /// </summary> /// <param name="galleryId">The gallery ID.</param> /// <returns>Returns a <see cref="Watermark" /> instance.</returns> public static Watermark GetUserSpecifiedWatermark(int galleryId) { IGallerySettings gallerySetting = Factory.LoadGallerySetting(galleryId); Watermark tempWatermark = null; try { tempWatermark = new Watermark(); tempWatermark.WatermarkText = gallerySetting.WatermarkText; tempWatermark.TextFontName = gallerySetting.WatermarkTextFontName; tempWatermark.TextColor = HelperFunctions.GetColor(gallerySetting.WatermarkTextColor); tempWatermark.TextHeightPixels = gallerySetting.WatermarkTextFontSize; tempWatermark.TextWidthPercent = gallerySetting.WatermarkTextWidthPercent; tempWatermark.TextOpacityPercent = gallerySetting.WatermarkTextOpacityPercent; tempWatermark.TextLocation = gallerySetting.WatermarkTextLocation; tempWatermark.ImagePath = gallerySetting.WatermarkImagePath; tempWatermark.ImageWidthPercent = gallerySetting.WatermarkImageWidthPercent; tempWatermark.ImageOpacityPercent = gallerySetting.WatermarkImageOpacityPercent; tempWatermark.ImageLocation = gallerySetting.WatermarkImageLocation; } catch { if (tempWatermark != null) tempWatermark.Dispose(); throw; } return tempWatermark; }
/// <summary> /// Gets the watermark to use when the application is in reduced functionality mode. /// </summary> /// <param name="galleryId">The gallery ID.</param> /// <returns>Returns a <see cref="Watermark" /> instance.</returns> public static Watermark GetReducedFunctionalityModeWatermark(int galleryId) { IGallerySettings gallerySetting = Factory.LoadGallerySetting(galleryId); Watermark tempWatermark = null; try { tempWatermark = new Watermark(); tempWatermark.WatermarkText = GalleryServerPro.Business.Properties.Resources.Reduced_Functionality_Mode_Watermark_Text; tempWatermark.TextFontName = gallerySetting.WatermarkTextFontName; tempWatermark.TextColor = HelperFunctions.GetColor(gallerySetting.WatermarkTextColor); tempWatermark.TextHeightPixels = 0; tempWatermark.TextWidthPercent = 100; tempWatermark.TextOpacityPercent = 100; tempWatermark.TextLocation = ContentAlignment.MiddleCenter; tempWatermark._watermarkImage = GalleryServerPro.Business.Properties.Resources.GSP_Logo; tempWatermark.ImageWidthPercent = 85; tempWatermark.ImageOpacityPercent = 50; tempWatermark.ImageLocation = ContentAlignment.BottomCenter; } catch { if (tempWatermark != null) tempWatermark.Dispose(); throw; } return tempWatermark; }
/// <summary> /// Overlay the text and/or image watermark over the image specified in the filePath parameter and return. /// </summary> /// <param name="filePath">A string representing the full path to the image file /// (e.g. "C:\mypics\myprettypony.jpg", "myprettypony.jpg").</param> /// <returns>Returns a System.Drawing.Image instance containing the image with the watermark applied.</returns> public static System.Drawing.Image AddWatermark(string filePath) { Watermark wm = Watermark.Instance; return(wm.ApplyWatermark(filePath)); }