public void SetImageSize(Topic topic, ImageLabel image) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (image == null) { throw new ArgumentNullException(nameof(image)); } #endregion using (System.IO.Stream imageStream = FileContainer.GetFileStream(image.Id, GetImageFolder(topic))) { if (ImageUtil.IsValidImage(imageStream, image.Id)) { Rect imageDimension = ImageUtil.GetDimensionFromImage(imageStream); image.Height = imageDimension.Height; image.Width = imageDimension.Width; } } }
public System.IO.Stream GetImage(Topic topic, string imageFileName) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (string.IsNullOrEmpty(imageFileName)) { throw new ArgumentNullException(nameof(imageFileName)); } #endregion // get path to imagefolder string[] imageFolderPath = GetImageFolder(topic); return(FileContainer.GetFileStream(imageFileName, imageFolderPath)); }