예제 #1
0
        public ImageItem(string imageUrl)
        {
            try
            {
                ImageFullThumbnailUrl = imageUrl;
                ImageFullUrl          = imageUrl.Replace(@"Thumbnail\", string.Empty);
                Name  = Path.GetFileNameWithoutExtension(ImageFullThumbnailUrl);
                Month = Path.GetFileNameWithoutExtension(Path.GetDirectoryName(ImageFullThumbnailUrl));
                Year  = Path.GetFileNameWithoutExtension(Path.GetDirectoryName((Path.GetDirectoryName(ImageFullThumbnailUrl))));
                string strDirName;

                int intLocation, intLength;

                intLength   = imageUrl.Length;
                intLocation = imageUrl.IndexOf("OutputDir");

                strDirName = imageUrl.Substring(intLocation, intLength - intLocation);

                ImageRelativePathThumbnail = @"~\" + strDirName;
                ImageRelativePath          = ImageRelativePathThumbnail.Replace(@"Thumbnail\", string.Empty);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// constructor.
        /// initialize new photo obj.
        /// </summary>
        /// <param name="imageUrl"></param>
        public Photo(string imageUrl)
        {
            try
            {
                ImageUrl     = imageUrl;
                ImageFullUrl = imageUrl.Replace(@"Thumbnails\", string.Empty);
                Name         = Path.GetFileNameWithoutExtension(ImageUrl);
                Month        = Path.GetFileNameWithoutExtension(Path.GetDirectoryName(ImageUrl));
                Year         = Path.GetFileNameWithoutExtension(Path.GetDirectoryName((Path.GetDirectoryName(ImageUrl))));
                string strDirName;

                int intLocation, intLength;

                intLength   = imageUrl.Length;
                intLocation = imageUrl.IndexOf("Images");

                strDirName = imageUrl.Substring(intLocation, intLength - intLocation);

                ImageRelativePathThumbnail = @"~\" + strDirName;// Images\Thumbnails\" + Year + @"\" + Month + @"\" + Path.GetFileName(ImageUrl);
                ImageRelativePath          = ImageRelativePathThumbnail.Replace(@"Thumbnails\", string.Empty);
            }
            catch (Exception ex)
            {
            }
        }