Example #1
0
        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;
                }
            }
        }
Example #2
0
        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));
        }