Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pictures"></param>
        /// <returns></returns>
        public static int ReducePictures(List <Picture> pictures, string targetPath, int width)
        {
            var count = 0;

            if (pictures == null || !pictures.Any())
            {
                return(count);
            }

            for (var i = 0; i < pictures.Count; i++)
            {
                var picture = pictures[i];

                var target = targetPath + "\\" + picture.PicName;

                var success = PictureHandler.GetReducedImage(picture.Path, width, target);

                if (success)
                {
                    count++;
                    picture.SnapshotPath = target;
                }
            }

            return(count);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取图片信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        private static Picture GetPicture(FileInfo info)
        {
            var picture = new Picture();

            picture.Description = string.Empty;
            picture.FileSize    = Math.Ceiling(info.Length / 1024.0);
            picture.PicName     = info.Name;
            picture.Path        = info.FullName;
            picture.Id          = GUIDHelper.GetGuid();

            PictureHandler.FillPictureInfo(picture);

            return(picture);
        }